jimczi commented on a change in pull request #1351: LUCENE-9280: Collectors to skip noncompetitive documents URL: https://github.com/apache/lucene-solr/pull/1351#discussion_r394676728
########## File path: lucene/core/src/java/org/apache/lucene/search/Weight.java ########## @@ -223,44 +257,23 @@ public int score(LeafCollector collector, Bits acceptDocs, int min, int max) thr * See <a href="https://issues.apache.org/jira/browse/LUCENE-5487">LUCENE-5487</a> */ static int scoreRange(LeafCollector collector, DocIdSetIterator iterator, TwoPhaseIterator twoPhase, Bits acceptDocs, int currentDoc, int end) throws IOException { - if (twoPhase == null) { - while (currentDoc < end) { - if (acceptDocs == null || acceptDocs.get(currentDoc)) { - collector.collect(currentDoc); - } - currentDoc = iterator.nextDoc(); - } - return currentDoc; - } else { - final DocIdSetIterator approximation = twoPhase.approximation(); - while (currentDoc < end) { - if ((acceptDocs == null || acceptDocs.get(currentDoc)) && twoPhase.matches()) { - collector.collect(currentDoc); - } - currentDoc = approximation.nextDoc(); + while (currentDoc < end) { + if ((acceptDocs == null || acceptDocs.get(currentDoc)) && (twoPhase == null || twoPhase.matches())) { + collector.collect(currentDoc); } - return currentDoc; + currentDoc = iterator.nextDoc(); } + return currentDoc; Review comment: this change is not required ? I see hotspot in the javadoc comment above so we shouldn't touch it if it's not required ;). ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org