lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: BooleanWeight.normalize(float) doesn't normalize prohibited clauses?
Date Thu, 11 May 2006 07:49:27 GMT

: > Does anyone know why normalize ignores the prohibited clauses?  was that
: > just intended to be an optimization (save time calculating stuff for
: > clauses we don't care about scoring in depth) ... ?
: A prohibited clause will never occur in any matching document, so it
: will never need to take part in any score value calculation.

that's true ... but when calculating an Explanation, the only way
BooleanWeight.explain has to determine wether or not a clause matched, is
by looking at the value of it's Explanation -- if the clause has never
been normalized, it's Explanation may be inacurate.  As i mentioned...

: > ...since prohibited clauses aren't normalized, they sub-weights don't get
: > their weights set properly, which means that when the Explanation is
: > claculated, they tend to result in an Explanation with a value of "0" ...
: > and since they are prohibited, the Explanation for BooleanQuery thinks
: > that is a good thing.

To elaborate: if a prohibited clause is a TermQuery, and that TermQuery
isn't normalized, it will return an Explanation with a value of 0.0f for
both matches and non matches.  When BooleanWeight.explain sees that the
Explanation for the prohibited clause has a value of 0.0f it assumes that
ment the clause didn't match.

In essense, BooleanWeight.explain relies on a precondition
BooleanWeight.normalize doesn't establish.

The attachments in LUCENE-557 demonstrate this problem.  In particular,
take a look at the testBQ* functions in


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

View raw message