class Ferret::Store::RAMDirectory
Memory resident Directory implementation. You should use a RAMDirectory during testing but otherwise you should stick with FSDirectory. While loading an index into memory may slightly speed things up, on most operating systems there won't be much difference so it wouldn't be worth your trouble.
Public Class Methods
new(dir = nil)
click to toggle source
Create a new RAMDirectory.
You can optionally load another Directory (usually a FSDirectory) into memory. This may be useful to speed up search performance but usually the speedup won't be worth the trouble. Be sure to benchmark.
- dir
-
Directory to load into memory
static VALUE frb_ramdir_init(int argc, VALUE *argv, VALUE self) { VALUE rdir; Store *store; switch (rb_scan_args(argc, argv, "01", &rdir)) { case 1: { Store *ostore; Data_Get_Struct(rdir, Store, ostore); store = open_ram_store_and_copy(ostore, false); break; } default: store = open_ram_store(); } Frt_Wrap_Struct(self, NULL, &frb_dir_free, store); object_add(store, self); rb_ivar_set(self, id_ref_cnt, INT2FIX(0)); return self; }