You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jp...@apache.org on 2015/03/03 18:58:22 UTC

svn commit: r1663756 - /lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java

Author: jpountz
Date: Tue Mar  3 17:58:22 2015
New Revision: 1663756

URL: http://svn.apache.org/r1663756
Log:
LUCENE-6329: Calling score() should be ok even if needsScores is false.

Modified:
    lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java

Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java?rev=1663756&r1=1663755&r2=1663756&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java Tue Mar  3 17:58:22 2015
@@ -152,13 +152,16 @@ abstract class DisjunctionScorer extends
               previous = w;
             }
           }
-
-          // We need to explicitely set the list of top scorers to avoid the
-          // laziness of DisjunctionScorer.score() that would take all scorers
-          // positioned on the same doc as the top of the pq, including
-          // non-matching scorers
-          DisjunctionScorer.this.topScorers = topScorers;
+        } else {
+          // since we don't need scores, let's pretend we have a single match
+          topScorers.next = null;
         }
+
+        // We need to explicitely set the list of top scorers to avoid the
+        // laziness of DisjunctionScorer.score() that would take all scorers
+        // positioned on the same doc as the top of the pq, including
+        // non-matching scorers
+        DisjunctionScorer.this.topScorers = topScorers;
         return true;
       }
     };