Re: IndexReader close listeners and NRT

2013-11-10 Thread Ravikumar Govindarajan
Thanks Mike. Explicit type-cast to SegmentReader will do the trick for the moment. -- Ravi On Fri, Nov 8, 2013 at 6:17 PM, Michael McCandless < luc...@mikemccandless.com> wrote: > On Fri, Nov 8, 2013 at 12:22 AM, Ravikumar Govindarajan > wrote: > >> So, in your code, "reader" is the top-level

Re: IndexReader close listeners and NRT

2013-11-08 Thread Michael McCandless
On Fri, Nov 8, 2013 at 12:22 AM, Ravikumar Govindarajan wrote: >> 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 intention

Re: IndexReader close listeners and NRT

2013-11-07 Thread Ravikumar Govindarajan
> 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(Ato

Re: IndexReader close listeners and NRT

2013-11-07 Thread Michael McCandless
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

Re: IndexReader close listeners and NRT

2013-11-07 Thread Ravikumar Govindarajan
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?. I saw that FieldCacheImpl is using a CoreClosedListener, whereas I am using

Re: IndexReader close listeners and NRT

2013-11-07 Thread Michael McCandless
Hi, a few comments on quickly looking at the code... It's sort of strange, inside the Weight.scorer() method, to go and build an IndexSearcher and run a whole new search, if the cache entry is missing. Could you instead just do a top-level search, which then populates the cache per-segment? Also

Re: IndexReader close listeners and NRT

2013-11-07 Thread Ravikumar Govindarajan
Thanks Mike. Can you help me out with one more question? I have a sample impl as below, where I am adding a ReaderClosedListener to purge the BitSet. When using NRT with applyAllDeletes, old-reader will get closed and new-reader will open. In such a case, will the below impl-cache also be purged

Re: IndexReader close listeners and NRT

2013-11-07 Thread Michael McCandless
You need to call .getCoreCacheKey() on each of the sub-readers (returned by IndexReader.leaves()), to play well with NRT. Typically you'd do so in a context that already sees each leaf, like a custom Filter or a Collector. Mike McCandless http://blog.mikemccandless.com On Thu, Nov 7, 2013 at 1

IndexReader close listeners and NRT

2013-11-06 Thread Ravikumar Govindarajan
I am trying to cache a BitSet by attaching to IndexReader.addCloseListener, using the getCoreCacheKey() But, I find that getCoreCacheKey() returns the IndexReader object itself as the key. Whenever the IndexReader re-opens via NRT because of deletes, will it mean that my cache will be purged, bec