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