On Fri, Apr 24, 2009 at 10:26:21PM +0300, Shai Erera wrote:

> I think we can make some optimization to DocIdSetIterator. Today, it defines
> next() and skipTo(int) which return a boolean. I've checked the code and it
> looks like almost always when these two are called, they are followed by a
> call to doc().
> 
> I was thinking that if those two returned the doc Id they are at, instead of
> boolean, that will save the call to doc(). 

> What do you think? 

It'll work.

Nathan Kurz proposed exactly this change for KinoSearch last July. 

    <http://rectangular.com/pipermail/kinosearch/2007-July/004149.html>

    I think there is a small gain by having Scorer_Advance return a doc number
    directly rather than a boolean, obviating the need for a follow-up call to
    Scorer_Doc.

I finished the implementation last October.

One additional wrinkle, though: doc nums start at 1 rather than 0, so the
return values for Next() and Advance() can double as a booleans.

Marvin Humphrey


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

Reply via email to