Code looks fine and will not zap the current contents of indexDir. Something else must be - another call with OpenMode.CREATE? Where is indexDir - could tomcat be zapping it on startup? Some other job?
-- Ian. On Thu, Jul 28, 2011 at 8:12 PM, Saurabh Gokhale <saurabhgokh...@gmail.com> wrote: > 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 > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org