lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mihai Caraman <>
Subject Re: Questions on index Writer
Date Sat, 16 Jul 2011 20:08:06 GMT
> indexWriter = new IndexWriter( File(indexDirName)),
> getAnalyzer(), true, MaxFieldLength.UNLIMITED);
> Does this statement cleans up existing index files?


> If yes, then how do I
> tackle a scenario where lets say I brought down my application server
> hosting code to create lucene index and then start it again, this way a new
> JVM will start creating indexWriter instance again which will eventually
> clean up my existing index files.

indexWriter = new IndexWriter( File(indexDirName)),
           getAnalyzer(), *false*, MaxFieldLength.UNLIMITED);

 To avoid using deprecated method use the equivalent code:

        Directory idx = new NIOFSDirectory(new File(indexDirName), null);
        IndexWriterConfig iConfig = new
        indexWriter = new IndexWriter(idx, iConfig);

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message