lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cool Coder <>
Subject Re: How to delete old index
Date Sun, 25 Nov 2007 20:05:26 GMT
>What do you mean by "you can see two index"?
  I can see two sets of lucene index files with same size and time stamp difference is 4 hrs.
  E.g. At start up , the lucence generated index file 
  _8w.cfs (also some more files)  with size 4 MB and time stamp  November 24, 2007, 2:57:48

  After 4 hr, it generated another set of files like _32.cfs(also some more files) with size
4MB and timestamp November 24, 2007, 6:59:48 PM.
  But at the sametime, old index files did not get deleted. I think that all old index files
should get deleted once new index is created and IndexReader is reopened.
  Can you tell me why this is not happening?
  - BR

Michael McCandless <> wrote:
  "Cool Coder" wrote:
> Hi,
> I used have index refreshed in every 4 hr. However after each
> refresh, I can see two index. I am not sure how can I delete old
> index.

What do you mean by "you can see two index"?

> On starting of indexing process, I create Writer
> writer = new IndexWriter(luceneDirectory,false,luceneAnalyzer,true);

This is exactly right. That final true (which is the "create" arg) will
clear out the index.

> At the end of Indexing process:
> writer.flush();
> writer.close();

The writer.flush() isn't necessary: writer.close() will always flush.

> and reopen the indexreader
> luceneDirectory = FSDirectory.getDirectory(indexPath);
> reader =;
> searcher = new IndexSearcher(reader);
> Is this the right way or I am missing something?
> Let me tell you that I dont want to update index rather I just want to
> delete the old index.
> Your help would be appreciated.

This looks right to me!


To unsubscribe, e-mail:
For additional commands, e-mail:

Be a better pen pal. Text or chat with friends inside Yahoo! Mail. See how.
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message