lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Lea <ian....@gmail.com>
Subject Re: Need Help: Index directory files getting deleted due to server restart.
Date Fri, 29 Jul 2011 09:13:44 GMT
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
<saurabhgokhale@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-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message