lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Elschot <>
Subject Re: passing required sub-scorers to BooleanScorer?
Date Sun, 08 Aug 2010 15:13:31 GMT
Op zondag 08 augustus 2010 16:04:54 schreef Michael McCandless:
> I noticed that the SubScorer in BooleanScorer is able to handle
> "required" clauses, and spends some CPU confirming each hit matches
> the required clauses.
> Yet, BooleanQuery will never do so (it always uses BooleanScorer2 if
> there are any required clauses).
> And, if I assert !required in BooleanScorer, all tests pass... so it
> really looks to be unused code.
> Does anyone know the history here? 

BooleanScorer2 was introduced to use advance() (former skipTo())
when not all subscorers are required.
Iirc when skipTo() was introduced it was initially only used by
ConjunctionScorer (all required, AND type query) and PhraseScorer.
BooleanScorer works nicely when some sub-scorers are required
but it neither uses nor provides advance(), so it should always be
used with some care. And when no particular sub-scorer is required
(OR type query) BooleanScorer is the fastest one around, but it can
score docs out of order.

> Did we used to have BooleanScorer
> handle certain BQ's with required clauses?  

Before skipTo() all such BQ's were handled by BooleanScorer.

> (It seems likely it could
> give better performance in many cases, eg when the freq of the 2
> sub-queries are comparable).

Do you mean when the 2 sub-queries have many docs in common?
In that case an AND is almost equivalent to an OR, so
BooleanScorer could indeed be faster than BooleanScorer2.

Paul Elschot

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message