lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cool Coder <techcool.ku...@yahoo.com>
Subject Re: How to delete old index
Date Mon, 26 Nov 2007 02:15:06 GMT
I tried with your suggestion but still it did not delete old index files. Anyway I closed reader
before closing writer and reopened reader after closing writer which deleted all old index
files.
   
  reader.close();
  writer.close();
  reader.open();
   
  - RB

Michael McCandless <lucene@mikemccandless.com> wrote:
  
"Cool Coder" wrote:
> Yes. Because I cannot close IndexReader in the live system. And also I
> am running on Windows server. 
> At the end of index writing, I close writer and also reopen reader

OK, I'm glad we have it explained!

> writer.close()
> reader.close();
> reader = IndexReader.open(luceneDirectory);
> searcher = new IndexSearcher(reader);
> 
> Still I can see old files. Is there still a way to delete old index
> files.

Just insert this:

new IndexWriter(luceneDirectory, analyzer).close();

after you've reopened your reader above. That should prune all deletable files from the index.

Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org



       
---------------------------------
Never miss a thing.   Make Yahoo your homepage.
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message