Class: Ferret::Store::FSDirectory

### Home Classes Methods

### In Files

- ext/r_store.c

### Parent

Ferret::Store::Directory

### Methods

- ::new

### Files

- MIT-LICENSE
- README
- TODO
- TUTORIAL

### Class/Module Index

Quicksearch

- Ferret
- Ferret::BlankSlate
- Ferret::BoostMixin
- Ferret::Browser
- Ferret::Browser::Controller
- Ferret::Browser::Delegator
- Ferret::Browser::DocumentController
- Ferret::Browser::ErrorController
- Ferret::Browser::HelpController
- Ferret::Browser::HomeController
- Ferret::Browser::TermController
- Ferret::Browser::TermVectorController
- Ferret::Browser::ViewHelper
- Ferret::Document
- Ferret::Field
- Ferret::FieldSymbol
- Ferret::FieldSymbolMethods
- Ferret::FileNotFoundError
- Ferret::Index
- Ferret::Index::FieldInfo
- Ferret::Index::FieldInfos
- Ferret::Index::Index
- Ferret::Index::IndexReader
- Ferret::Index::IndexWriter
- Ferret::Index::LazyDoc
- Ferret::Index::LazyDoc::LazyDocData
- Ferret::Index::TermDocEnum
- Ferret::Index::TermEnum
- Ferret::Index::TermVector
- Ferret::Index::TermVector::TVOffsets
- Ferret::Index::TermVector::TVTerm
- Ferret::ParseError
- Ferret::QueryParser
- Ferret::QueryParser::QueryParseException
- Ferret::Search
- Ferret::Search::BooleanQuery
- Ferret::Search::BooleanQuery::BooleanClause
- Ferret::Search::ConstantScoreQuery
- Ferret::Search::Explanation
- Ferret::Search::Filter
- Ferret::Search::FilteredQuery
- Ferret::Search::FuzzyQuery
- Ferret::Search::Hit
- Ferret::Search::MatchAllQuery
- Ferret::Search::MultiSearcher
- Ferret::Search::MultiTermQuery
- Ferret::Search::PhraseQuery
- Ferret::Search::PrefixQuery
- Ferret::Search::Query
- Ferret::Search::QueryFilter
- Ferret::Search::RangeFilter
- Ferret::Search::RangeQuery
- Ferret::Search::Searcher
- Ferret::Search::Sort
- Ferret::Search::SortField
- Ferret::Search::Spans
- Ferret::Search::Spans::SpanFirstQuery
- Ferret::Search::Spans::SpanMultiTermQuery
- Ferret::Search::Spans::SpanNearQuery
- Ferret::Search::Spans::SpanNotQuery
- Ferret::Search::Spans::SpanOrQuery
- Ferret::Search::Spans::SpanPrefixQuery
- Ferret::Search::Spans::SpanTermQuery
- Ferret::Search::TermQuery
- Ferret::Search::TopDocs
- Ferret::Search::TypedRangeFilter
- Ferret::Search::TypedRangeQuery
- Ferret::Search::WildcardQuery
- Ferret::StateError
- Ferret::Store
- Ferret::Store::Directory
- Ferret::Store::FSDirectory
- Ferret::Store::Lock
- Ferret::Store::Lock::LockError
- Ferret::Store::RAMDirectory
- WEBrick
- WEBrick::FerretBrowserHandler
- Date
- DateTime
- FileUtils
- Float
- Integer
- String
- Symbol
- Time

No matching classes.

# Ferret::Store::FSDirectory

### Public Class Methods

new(/path/to/index/, create = false) click to toggle source

Create a new FSDirectory at `/path/to/index/` which must be a valid path on your file system. If it doesn't exist it will be created. You can also specify the `create` parameter. If `create` is true the FSDirectory will be refreshed as new. That is to say, any existing files in the directory will be deleted. The default value for `create` is false.

path | path to index directory. Must be a valid path on your system
create | set to true if you want any existing files in the directory to be deleted

    static VALUE
    frb_fsdir_new(int argc, VALUE *argv, VALUE klass)
    {
        VALUE self, rpath, rcreate;
        Store *store;
        bool create;

        rb_scan_args(argc, argv, "11", &rpath, &rcreate);
        StringValue(rpath);
        create = RTEST(rcreate);
        if (create) {
            frb_create_dir(rpath);
        }
        if (!rb_funcall(rb_cFile, id_is_directory, 1, rpath)) {
            rb_raise(rb_eIOError, "No directory <%s> found. Use :create => true"
                     " to create one.", rs2s(rpath));
        }
        store = open_fs_store(rs2s(rpath));
        if (create) store->clear_all(store);
        if ((self = object_get(store)) == Qnil) {
            self = Data_Wrap_Struct(klass, NULL, &frb_dir_free, store);
            object_add(store, self);
            rb_ivar_set(self, id_ref_cnt, INT2FIX(0));
        }
        else {
            int ref_cnt = FIX2INT(rb_ivar_get(self, id_ref_cnt)) + 1;
            rb_ivar_set(self, id_ref_cnt, INT2FIX(ref_cnt));
            DEREF(store);
        }
        return self;
    }

[Validate]

Generated with the Darkfish Rdoc Generator 2.