jpountz commented on PR #15081: URL: https://github.com/apache/lucene/pull/15081#issuecomment-3194634987
This is interesting, this suggests that we're scoring too many docs with the leading clause. With your change, we're skipping these docs after scoring them with the first clause, but we should be able to skip these docs _before_ scoring them as well? With something like that: ```patch diff --git a/lucene/core/src/java/org/apache/lucene/search/BlockMaxConjunctionBulkScorer.java b/lucene/core/src/java/org/apache/lucene/search/BlockMaxConjunctionBulkScorer.java index 21f8af990b8..c2030dbc8fb 100644 --- a/lucene/core/src/java/org/apache/lucene/search/BlockMaxConjunctionBulkScorer.java +++ b/lucene/core/src/java/org/apache/lucene/search/BlockMaxConjunctionBulkScorer.java @@ -178,6 +178,7 @@ final class BlockMaxConjunctionBulkScorer extends BulkScorer { docAndScoreAccBuffer.copyFrom(docAndScoreBuffer); + int maxOtherDoc = -1; for (int i = 1; i < scorers.length; ++i) { double sumOfOtherClause = sumOfOtherClauses[i]; if (sumOfOtherClause != sumOfOtherClauses[i - 1]) { @@ -188,20 +189,17 @@ final class BlockMaxConjunctionBulkScorer extends BulkScorer { } ScorerUtil.applyRequiredClause(docAndScoreAccBuffer, iterators[i], scorables[i]); + maxOtherDoc = Math.max(iterators[i].docID(), maxOtherDoc); } for (int i = 0; i < docAndScoreAccBuffer.size; ++i) { scorable.score = (float) docAndScoreAccBuffer.scores[i]; collector.collect(docAndScoreAccBuffer.docs[i]); } - } - int maxOtherDoc = -1; - for (int i = 1; i < iterators.length; ++i) { - maxOtherDoc = Math.max(iterators[i].docID(), maxOtherDoc); - } - if (lead.docID() < maxOtherDoc) { - lead.advance(maxOtherDoc); + if (lead.docID() < maxOtherDoc) { + lead.advance(maxOtherDoc); + } } } ``` -- 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: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org