Hi All,

I am using following code to create Lucene index using writer object

if (indexWriter == null) {
        Directory idx = new NIOFSDirectory(new File(indexDir),null);
IndexWriterConfig iConfig = new IndexWriterConfig(Version.LUCENE_31,
getAnalyzer());
iConfig.setOpenMode(IndexWriterConfig.OpenMode.CREATE_OR_APPEND);
indexWriter = new IndexWriter(idx, iConfig);

indexWriter.setRAMBufferSizeMB(50);
indexWriter.setMaxBufferedDocs(100);
}

return indexWriter;

I have the application hosted on Tomcat 7. Now whenever I start / restart my
tomcat server, my index directory gets cleaned up (all lucene index files
are removed) and fresh indexing starts.

How can I stop it from happening? If this is the expected behavior, is there
any work around?

Thanks

Saurabh

Reply via email to