used WANDScorer.advanceShallow() to enable block-max optimizations when nested in conjunctions#16220
used WANDScorer.advanceShallow() to enable block-max optimizations when nested in conjunctions#16220iprithv wants to merge 2 commits into
Conversation
| for (Scorer scorer : allScorers) { | ||
| if (scorer.docID() < target) { | ||
| scorer.advanceShallow(target); | ||
| if (scorer.docID() <= target) { |
There was a problem hiding this comment.
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).
| 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); |
There was a problem hiding this comment.
Consider return (target <= upTo) ? Math.min(upTo, newUpTo) : newUpTo;
Otherwise the early return discards the freshly computed newUpTo, which could be tighter than upTo.
Always returning the previous upTo is safe (advanceShallow contract allows over-approximation), but it means the parent gets a looser bound than necessary hence the suggested conditional.
d494ad6 to
a09f3be
Compare
d494ad6 to
d245ee3
Compare
…ns when nested in conjunctions
d245ee3 to
fc65e6e
Compare
fc65e6e to
3175d3f
Compare
|
moved entry of changes.txt under 10.6 |
used WANDScorer.advanceShallow() so that WAND queries nested inside conjunctions can skip blocks instead of treating the entire segment as one giant block.