what about my code as follow:
FSDirectory indexDir = new NIOFSDirectory(new File("c:/index_folder"));
Directory ramDir = new RAMDirectory(indexDir);
IndexWriterConfig iwc = new IndexWriterConfig(Version.LUCENE_35,
new StandardAnalyzer(Version.LUCENE_35));
IndexWriter iw = new IndexWriter(ramDir, iwc);
I associate the FSDirectory and RAMDirectory as the very beginning. Will
the two be synchronized when the writer is committed or close?
Thanks
On Sun, Jan 1, 2012 at 2:56 PM, Charlie Hubbard
<[email protected]>wrote:
> You can always index into RAMDirectory for speed then synchronize those
> changes to the disk by adding the RAMDirectory to a FSDirectory at some
> point. Here is a simple example of how to do that:
>
> public void save( RAMDirectory ram, File dir ) {
> FSDirectory fs = FSDirectory.open( dir );
> IndexWriter writer = new IndexWriter( fs, ... );
> try {
> writer.addIndexes( ram );
> } finally {
> writer.close();
> }
> }
>
>
> http://lucene.apache.org/java/3_3_0/api/core/org/apache/lucene/index/IndexWriter.html#addIndexes(org.apache.lucene.store.Directory
> ..
> .)
>
> On Sat, Dec 31, 2011 at 3:37 PM, Cheng <[email protected]> wrote:
>
> > Hi,
> >
> > Suppose that we have a huge amount of indices on hard drives but working
> in
> > RAMDirectory is a must, how can we decide which part of the indices to be
> > loaded into RAM, how to modify the indices, and when and how to
> synchronize
> > the indices with those on hard drives?
> >
> > Any thoughts?
> >
> > Thanks!
> >
>