lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <>
Subject Re: Never close IndexWriter/Reader?
Date Sat, 03 May 2014 17:43:35 GMT
Just leave your IW open forever and periodically reopen your NRT
reader.  Be sure you close your old NRT reader after opening a new
one; SearcherManager makes this easy when multiple threads are using
the readers.

Committing every 200 docs seems quite frequent: commit is very costly,
and it's only needed for recovery (so you know which docs are in the
index if the machine/OS crashes).

Mike McCandless

On Sat, May 3, 2014 at 11:46 AM, Sascha Janz <> wrote:
> Hi,
> We use lucene 4.6, our application receives continuously new documents.
> Mostly emails. We need the update near real time, so we open the IndexReader
> with and IndexWriter.
> Periodically we do a commit, e.g. every 200 documents.
> We used to  close the IndexWriter on commit, and then open a new one. I read
> in documentation this is quite expensive, tests also showed me this. So we
> think about to only commit the IndexWriter and leave it open. So when should
> we close the IndexWriter? I think about to leave it open and only close it,
> when the server is shutting down. Is this a good idea? Any suggestions or
> comments?  Would be nice J
> Greetings
> Sascha

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

View raw message