lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <>
Subject Re: IndexReader.reopen() If Index Has Been Rebuilt
Date Thu, 14 Feb 2013 14:18:50 GMT
This use case is fine: you can fully re-index into an index that's
held open by an IndexReader.

It's best to use IndexWriterConfig's OpenMode.CREATE to do this
(instead of rm -rf /path/to/index): this way if something goes wrong
with your indexing before it has a chance to commit (eg JVM or OS
crashes or disk fills up or what not), your old index commit point
(that the existing reader is still searching) remains intact.

If you do "rm -rf /path/to/index" ... I'm not sure that IR.reopen()
will work correctly.  But if you use OpenMode.CREATE it will.

Mike McCandless

On Wed, Feb 13, 2013 at 1:28 PM, Wendy Meadows <> wrote:
> We're using Lucene 3.3.0 and have an index with close to 10 million
> documents.  When the application is started and the first search is
> performed, we open a read only IndexReader by calling
>, true).  For all following searches, we
> check if the indexReader is current and if not, call IndexReader.reopen().
>  What happens if we rebuild the index from scratch while using the same
> IndexReader and only refreshing it by calling reopen?  I can't seem to find
> any solid documentation explaining this, but have read a few things that
> are giving me the impression that this may not be the best approach.  Can
> someone at least point me to some documentation regarding this?
> Thank you!

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

View raw message