You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Sascha Janz <sa...@gmx.net> on 2014/05/03 17:46:13 UTC

Never close IndexWriter/Reader?

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 Directory.open 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