I am a novice in lucene. I write some code to do batch indexing using
RAMDirectory according to the code provided in lucene in action, which is
something like FSDirectory fsDir = FSDirectory.getDirectory("/tmp/index",

true);

RAMDirectory ramDir = new RAMDirectory();

IndexWriter fsWriter = IndexWriter(fsDir,

new SimpleAnalyzer(), true);

IndexWriter ramWriter = new IndexWriter(ramDir,

new SimpleAnalyzer(), true);

while (there are documents to index) {

... create Document ...

ramWriter.addDocument(doc);

if (condition for flushing memory to disk has been met) {

fsWriter.addIndexes(Directory[] {ramDir});

ramWriter.close();

ramWriter = new IndexWriter(ramDir, new SimpleAnalyzer(),

true);

}

}

But it cannot compile correctly on fsWriter.addIndexes(Directory[]
{ramDir}); It seems some problem with ramDir. Is there something changed at
lucene 2.0? How can I implement batch indexing correctly? Any simple code. 

Thanks!

 

Eric

 

 

Reply via email to