> 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).
Not really. It is an IndexSearcher(AtomicReader) that populates the BitSet > But, yes, your ReaderClosedListener will be called once that top-level > reader is closed, and that will then evict its entries from the cache. This is the current problem I am facing. I actually want to key on CoreClosedListener for this cache, but lucene exposes only a ReaderClosedListener(), which causes frequent purge/build of the cache during NRT life-cycle. Is it possible to hook into a CoreClosedListener somehow, so that I can mimic FieldCacheImpl behavior and become free from NRT logic? Also, when we have a getCoreCacheKey() exposed from IndexReader, should we also not have a addCoreClosedListener() in it? Will it cause too much confusion, as only SegmentReader might have a valid impl for that method? -- Ravi On Fri, Nov 8, 2013 at 12:04 AM, Michael McCandless < luc...@mikemccandless.com> wrote: > > On Thu, Nov 7, 2013 at 12:18 PM, Ravikumar Govindarajan > <ravikumar.govindara...@gmail.com> 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 > > Cool.... > > Mike McCandless > > http://blog.mikemccandless.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org >