-
Notifications
You must be signed in to change notification settings - Fork 1.4k
used WANDScorer.advanceShallow() to enable block-max optimizations when nested in conjunctions #16220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
used WANDScorer.advanceShallow() to enable block-max optimizations when nested in conjunctions #16220
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -566,17 +566,18 @@ public float score() throws IOException { | |
|
|
||
| @Override | ||
| public int advanceShallow(int target) throws IOException { | ||
| // Propagate to improve score bounds | ||
| // Propagate to sub-scorers. Scorers past target constrain the boundary to docID - 1. | ||
| int newUpTo = DocIdSetIterator.NO_MORE_DOCS; | ||
| for (Scorer scorer : allScorers) { | ||
| if (scorer.docID() < target) { | ||
| scorer.advanceShallow(target); | ||
| // Use <= instead of < so we still propagate and use the block boundary when already at | ||
| // target. | ||
| if (scorer.docID() <= target) { | ||
| newUpTo = Math.min(newUpTo, scorer.advanceShallow(target)); | ||
| } else if (scorer.docID() != DocIdSetIterator.NO_MORE_DOCS) { | ||
| newUpTo = Math.min(newUpTo, scorer.docID() - 1); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider Otherwise the early return discards the freshly computed newUpTo, which could be tighter than upTo. |
||
| } | ||
| } | ||
| if (target <= upTo) { | ||
| return upTo; | ||
| } | ||
| // TODO: implement | ||
| return DocIdSetIterator.NO_MORE_DOCS; | ||
| return newUpTo; | ||
| } | ||
|
|
||
| @Override | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: the old code used < target (skip propagation when already at target), this uses <= target. The <= is correct here since you need the return value from advanceShallow even when docID() == target, but worth a one-line comment explaining the change from < to <= (vs a typo).