jimczi commented on code in PR #16260:
URL: https://github.com/apache/lucene/pull/16260#discussion_r3415102526
##########
lucene/core/src/java/org/apache/lucene/search/MaxScoreBulkScorer.java:
##########
@@ -72,11 +72,18 @@ final class MaxScoreBulkScorer extends BulkScorer {
docAndScoreAccBuffer = new DocAndScoreAccBuffer();
docAndScoreAccBuffer.growNoCopy(INNER_WINDOW_SIZE);
- if (this.filter != null
- && this.filter.twoPhaseView == null
- && maxDoc >= INNER_WINDOW_SIZE
- && this.filter.cost >= maxDoc /
DenseConjunctionBulkScorer.DENSITY_THRESHOLD_INVERSE) {
- this.filterMatches = new FixedBitSet(INNER_WINDOW_SIZE);
+ if (this.filter != null && this.filter.twoPhaseView == null && maxDoc >=
INNER_WINDOW_SIZE) {
+ long minScorerCost = allScorers[0].cost;
+ for (int j = 1; j < allScorers.length; j++) {
+ minScorerCost = Math.min(minScorerCost, allScorers[j].cost);
+ }
+ // Use the bitset filter path if either:
+ // - the sparsest disjunction scorer is denser than the filter, OR
+ // - there are more than four scorers meaning that the overheap from
+ // maintaining the leapfrog heap is too high
+ if (minScorerCost >= this.filter.cost || allScorers.length > 4) {
Review Comment:
`this.cost` rather than `min` for the second part, since
`FilteredOrHighMed`'s high+med sum would otherwise wrongly pick the bitset.
(Also drops the `overheap` typo and updates the rationale.)
```suggestion
// - there are many scorers and their combined cost is denser than
the filter, so the
// candidate stream is dense enough to favor bulk bit-set gating
over per-candidate
// filter advance()
if (minScorerCost >= this.filter.cost
|| (allScorers.length > 4 && this.cost >= this.filter.cost)) {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]