mayya-sharipova commented on a change in pull request #1955: URL: https://github.com/apache/lucene-solr/pull/1955#discussion_r500708276
########## File path: lucene/core/src/java/org/apache/lucene/search/Weight.java ########## @@ -204,21 +204,21 @@ public int score(LeafCollector collector, Bits acceptDocs, int min, int max) thr collector.setScorer(scorer); DocIdSetIterator scorerIterator = twoPhase == null ? iterator : twoPhase.approximation(); DocIdSetIterator collectorIterator = collector.competitiveIterator(); - DocIdSetIterator filteredIterator; - if (collectorIterator == null) { - filteredIterator = scorerIterator; - } else { - if (scorerIterator.docID() != -1) { - // Wrap ScorerIterator to start from -1 for conjunction - scorerIterator = new RangeDISIWrapper(scorerIterator, max); - } - // filter scorerIterator to keep only competitive docs as defined by collector - filteredIterator = ConjunctionDISI.intersectIterators(Arrays.asList(scorerIterator, collectorIterator)); - } + DocIdSetIterator filteredIterator = scorerIterator; if (filteredIterator.docID() == -1 && min == 0 && max == DocIdSetIterator.NO_MORE_DOCS) { + if (collectorIterator != null) { + filteredIterator = ConjunctionDISI.intersectIterators(Arrays.asList(scorerIterator, collectorIterator)); + } scoreAll(collector, filteredIterator, twoPhase, acceptDocs); return DocIdSetIterator.NO_MORE_DOCS; } else { + if (collectorIterator != null) { + if (scorerIterator.docID() != -1) { + // here we assume that the initial version of collectorIterator matches all docs and can advance exactly to the desired docID Review comment: @jpountz My last [commit](4c5d8284941d315b7f15d819fbbc5d156421f02d) seems to address the test failures. I think it may work. Sorry again for the trouble. ---------------------------------------------------------------- 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 --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org