Is there a way to index data into memory without writing to disk in Lucene ?
This is my current code storing it on disk
writer = new IndexWriter(FSDirectory.open(index_dir), new
IndexWriterConfig(org.apache.lucene.util.Version.LUCENE_40, new
WhitespaceAnalyzer(org.apache.lucene.util.Version.LUCENE_40)));
//store sorted content to contents
Iterator<Map.Entry<String,Cluster>> it = clusters.entrySet().iterator();
while (it.hasNext()) {
...
Document document = new Document();
document.add(new Field("id", id, Field.Store.YES,
Field.Index.ANALYZED));
writer.addDocument(document);
}
writer.optimize();
writer.close();
thanks
|