lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: Lucene 2.9.0-rc5 : Reader stays open after IndexWriter.updateDocument(), is that possible?
Date Wed, 30 Sep 2009 00:58:45 GMT

: However, they may be something with the fact that Lucene's Analyzers
: automatically close the reader when its done analyzing. I think this
: encourages people not to explicitly close them, and creates the potential of
: having open fd's if an exception is thrown in the middle of the analysis or
: before addDocument/updateDocument is called.

It's always been the case that users should close their own Readers -- 
lucene's docs have never indicated that they will close hte reader for 
you, it's just a helpful side effect that once IndexWRiter has consumed 
all hte chars from a Reader it calls close() -- the caller should still 
close() explicitly for precisely the reasons you listed, but there's 
really no downside to multiple close calls.

even if we werent' worried about breaking existing client code (where 
people never call close themselves) it would still be a good idea to leave 
the close() calls in because the sooner the Readers are closed the sooner 
the descriptor can be released -- no reason to wait (ie: during a 
serialized merge for example) until addDocument is done if hte Reader has 
been completley exhausted.


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

View raw message