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:59:01 UTC

svn commit: r1663757 - in /lucene/dev/branches/branch_5x: ./ lucene/ lucene/core/ lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java

Author: jpountz
Date: Tue Mar  3 17:59:00 2015
New Revision: 1663757

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

Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/lucene/   (props changed)
    lucene/dev/branches/branch_5x/lucene/core/   (props changed)
    lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java

Modified: lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java?rev=1663757&r1=1663756&r2=1663757&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java (original)
+++ lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java Tue Mar  3 17:59:00 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;
       }
     };