You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2020/10/06 22:11:01 UTC

[GitHub] [lucene-solr] jpountz commented on a change in pull request #1955: LUCENE-9566 Move collectorIterator to the same doc as scorerIterator

jpountz commented on a change in pull request #1955:
URL: https://github.com/apache/lucene-solr/pull/1955#discussion_r500624839



##########
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:
       but that's not true, it it?




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org