lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pulkit Singhal <>
Subject Re: Does a IndexSearcher call incRef on the underlying reader?
Date Wed, 27 Oct 2010 16:48:09 GMT
@Question2: Also I was wondering what happens to the code that may have been
using the searcher which got swapped out in SearcherManager? Does that
IndexSearcher continue to run and when it finishes the GC is free to collect
it? OR will the fact that the reader for that searcher has had its last
decRef() call take the reader's internal count to 0 ... cause someone who is
paging through results to see the server choking with exceptions?

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

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message