jpountz commented on code in PR #13343: URL: https://github.com/apache/lucene/pull/13343#discussion_r1592678225
########## lucene/core/src/java/org/apache/lucene/search/BlockMaxConjunctionBulkScorer.java: ########## @@ -68,18 +88,10 @@ public int score(LeafCollector collector, Bits acceptDocs, int min, int max) thr // Use impacts of the least costly scorer to compute windows // NOTE: windowMax is inclusive int windowMax = Math.min(scorers[0].advanceShallow(windowMin), max - 1); - for (int i = 1; i < scorers.length; ++i) { - scorers[i].advanceShallow(windowMin); - } - double maxWindowScore = 0; - for (int i = 0; i < scorers.length; ++i) { - double maxClauseScore = scorers[i].getMaxScore(windowMax); - sumOfOtherClauses[i] = maxClauseScore; - maxWindowScore += maxClauseScore; - } - for (int i = sumOfOtherClauses.length - 2; i >= 0; --i) { - sumOfOtherClauses[i] += sumOfOtherClauses[i + 1]; + double maxWindowScore = Double.MAX_VALUE; Review Comment: POSITIVE_INFINITY? ########## lucene/core/src/java/org/apache/lucene/search/BlockMaxConjunctionBulkScorer.java: ########## @@ -56,9 +56,29 @@ final class BlockMaxConjunctionBulkScorer extends BulkScorer { scorer1 = this.scorers[0]; scorer2 = this.scorers[1]; this.sumOfOtherClauses = new double[this.scorers.length]; + for (int i = 0; i < sumOfOtherClauses.length; i++) { + sumOfOtherClauses[i] = Double.MAX_VALUE; Review Comment: make it `Double.POSITIVE_INFINITY`? ########## lucene/core/src/java/org/apache/lucene/search/BlockMaxConjunctionScorer.java: ########## @@ -167,8 +171,6 @@ private int doNext(int doc) throws IOException { } } - assert doc <= upTo; Review Comment: is there a way we can fix this assertion without dropping it entirely? ########## lucene/core/src/java/org/apache/lucene/search/BlockMaxConjunctionBulkScorer.java: ########## @@ -56,9 +56,29 @@ final class BlockMaxConjunctionBulkScorer extends BulkScorer { scorer1 = this.scorers[0]; scorer2 = this.scorers[1]; this.sumOfOtherClauses = new double[this.scorers.length]; + for (int i = 0; i < sumOfOtherClauses.length; i++) { + sumOfOtherClauses[i] = Double.MAX_VALUE; + } this.maxDoc = maxDoc; } + public float getMaxScore(int windowMin, int windowMax) throws IOException { Review Comment: can you rename it `computeMaxScore` to better indicate that it has side-effects (on `sumOfOtherClauses`)? -- 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