mirror of https://github.com/apache/lucene.git
LUCENE-8427: Fix bug in BlockMaxConjunctionScorer.
In case a scorer would return information about a block that doesn't contain any matches, BlockMaxConjunctionScorer could use invalid score bounds. This would never occur when building a conjunction of term queries but possibly when building a conjunction of phrase queries for instance.
This commit is contained in:
parent
35fa0b4f55
commit
65f6e6c150
|
@ -145,6 +145,20 @@ final class BlockMaxConjunctionScorer extends Scorer {
|
||||||
return NO_MORE_DOCS;
|
return NO_MORE_DOCS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (doc > upTo) {
|
||||||
|
// This check is useful when scorers return information about blocks
|
||||||
|
// that do not actually have any matches. Otherwise `doc` will always
|
||||||
|
// be in the current block already since it is always the result of
|
||||||
|
// lead.advance(advanceTarget(some_doc_id))
|
||||||
|
final int nextTarget = advanceTarget(doc);
|
||||||
|
if (nextTarget != doc) {
|
||||||
|
doc = lead.advance(nextTarget);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert doc <= upTo;
|
||||||
|
|
||||||
if (minScore > 0) {
|
if (minScore > 0) {
|
||||||
score = leadScorer.score();
|
score = leadScorer.score();
|
||||||
if (score < minScores[0]) {
|
if (score < minScores[0]) {
|
||||||
|
|
Loading…
Reference in New Issue