lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yakob <jacob...@opensuse-id.org>
Subject flushing index
Date Sun, 26 Sep 2010 04:17:12 GMT
hello all,
I am here to ask about lucene in flushing indexes.
below is a pseudocode I get from the book lucene in action.

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) { ///THIS LINE
FOR FLUSHING INDEX
fsWriter.addIndexes(Directory[] {ramDir});
ramWriter.close();
ramWriter = new IndexWriter(ramDir, new SimpleAnalyzer(),
true);
}
}

the above code has a condition to which the index need to be flush
from RAMDirectory to the disk. what I am asking is that what is the
correct source code to be used? I mean what is the source code for
flushing indexes? maybe some of you had tried it so can help me out
here. I am a bit stuck at this point. any help would be appreciated.

thanks

-- 
http://jacobian.web.id

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message