Skip to content

Commit

Permalink
Fix wrong condition in block_wand_single_scorer and add debug_assert …
Browse files Browse the repository at this point in the history
…to have an equality check on doc to break the loop.
  • Loading branch information
fmassot committed Oct 31, 2021
1 parent 2aee4fb commit afbf2e3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/query/boolean_query/block_wand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ pub fn block_wand_single_scorer(
// the threshold.
while scorer.block_max_score() < threshold {
let last_doc_in_block = scorer.last_doc_in_block();
if doc == TERMINATED {
if last_doc_in_block == TERMINATED {
return;
}
doc = last_doc_in_block + 1;
Expand All @@ -247,7 +247,7 @@ pub fn block_wand_single_scorer(
if score > threshold {
threshold = callback(doc, score);
}
if doc >= scorer.last_doc_in_block() {
if doc == scorer.last_doc_in_block() {
break;
}
doc = scorer.advance();
Expand Down

0 comments on commit afbf2e3

Please sign in to comment.