Some of the minimum-interval algorithms will call nextInterval() or start() 
even after the interval has been exhausted, so we need to handle those 
situations properly.  Improved java doc would definitely be helpful though, and 
maybe we should update checkIntervals() in TestIntervals to test what happens 
when calling nextInterval() after it has returned NO_MORE_INTERVALS.  Do you 
want to open an issue?

- Alan

> On 19 Nov 2020, at 08:17, Haoyu Zhai <zhai7...@gmail.com> wrote:
> 
> Hi,
> I'm trying to play around with my own IntervalSource and found out that 
> "nextInterval" method of IntervalIterator will be called sometimes even after 
> "nextDoc"/"docID"/"advance" method returns NO_MORE_DOCS.
> After I dug a bit more I found that FilteringIntervalIterator.reset is 
> calling an inner iterator's "nextInterval" regardless of what the result of 
> "nextDoc", and also most (if not all) existing IntervalIterator's 
> implementation do considered the case where "nextInterval" is called after 
> "nextDoc" returns NO_MORE_DOCS.
> I'm a bit confused here since I thought in most places lucene assumes 
> undefined behavior after NO_MORE_DOCS are returned for those method should be 
> called only after "advance", but for "nextInterval" seems its not the case. 
> Should we change the current behavior of "nextInterval" implementations or 
> add some caution comment to javadoc?
> 
> Thanks
> Patrick Zhai


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to