lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael McCandless" <>
Subject Re: How to delete old index
Date Sun, 25 Nov 2007 09:51:51 GMT
"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:

View raw message