lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <>
Subject Re: Does a IndexSearcher call incRef on the underlying reader?
Date Wed, 27 Oct 2010 16:49:48 GMT
IndexSearcher does not incRef the reader passed to it.


On Wed, Oct 27, 2010 at 12:35 PM, Pulkit Singhal
<> wrote:
> Hello,
> I have been looking at the SearcherManager example provided in the "Lucene
> In Action 2nd Edition" book. It seems like a great way to manage
> IndexReaders but I had a few questions about the Lucene API that poppedup
> after reading it:
> @Question: Does a IndexSearcher call upon an IndexReader's incRef() method
> internally when the reader is passed in as an argument to the searcher's
> constructor?
> @Motivation: I ask because, if that is the case then I will need to make an
> additional call to decRef(). Also the book claims that
> "IndexSearcher.close() is a no-op if you provide an already opened
> IndexReader when creating the IndexSearcher" so I guess I can't count on
> that close() method to call the decRef() method for me and I must call it
> myself?  Once again, I'm thinking of doing all this only if incRef() was
> called on the reader in the searcher's constructor, which I'm hoping someone
> will confirm for me.
> Thanks,
> - Pulkit

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

View raw message