lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <>
Subject Re: IndexReader close listeners and NRT
Date Thu, 07 Nov 2013 18:34:35 GMT
On Thu, Nov 7, 2013 at 12:18 PM, Ravikumar Govindarajan
<> wrote:
> Thanks Mike.
> If you look at my impl, I am using the getCoreCacheKey() only, but keyed
> on a ReaderClosedListener and purging it onClose(). When NRT does reopens,
> will it invoke the onClose() method for the expired-reader?.

OK, I see.

So, in your code, "reader" is the top-level reader, not the one
segment you are pulling a scorer on (context.reader()).

So you are building your cache on the top-level reader, not the
segment's reader?  Is that intentional?  (It's not NRT friendly).

But, yes, your ReaderClosedListener will be called once that top-level
reader is closed, and that will then evict its entries from the cache.

> I saw that
> FieldCacheImpl is using a CoreClosedListener, whereas I am using a
> ReaderClosedListener. What is the difference between these two?

A single segment's core readers (that read the postings, stored
fields, term vectors, etc.) are shared between multiple SegmentReader
instances; each of those SegmentReader instances only changes in what
documents are deleted.  The core is closed only once all
SegmentReaders that share that core have been closed.

> I will surely look at the FBS replacement you have pointed out. BTW, this
> method actually runs during opening of an index for the first-time. May be
> for clarity and organisation, I will refactor this code as you have
> suggested


Mike McCandless

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

View raw message