Skip to content

Commit

Permalink
Add case for weight.count == 0
Browse files Browse the repository at this point in the history
Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com>
  • Loading branch information
sandeshkr419 committed Feb 3, 2024
1 parent 2a9cce7 commit 58716d2
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,12 @@ LeafBucketCollector termDocFreqCollector(
// Calculate weight if not assigned previously
this.weight = context.searcher().createWeight(context.query(), ScoreMode.COMPLETE_NO_SCORES, 1f);
}

if (weight.count(ctx) == 0) {
// No documents matches top level query on this segment, we can skip it
return LeafBucketCollector.NO_OP_COLLECTOR;
}

if (weight.count(ctx) != ctx.reader().maxDoc()) {
// Top-level query does not match all docs in this segment.
return null;
Expand Down

0 comments on commit 58716d2

Please sign in to comment.