You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by yo...@apache.org on 2011/04/11 17:26:20 UTC

svn commit: r1091100 - /lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/function/QueryValueSource.java

Author: yonik
Date: Mon Apr 11 15:26:19 2011
New Revision: 1091100

URL: http://svn.apache.org/viewvc?rev=1091100&view=rev
Log:
SOLR-2464: dont' try to create scorer for each doc if null was returned the first time

Modified:
    lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/function/QueryValueSource.java

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/function/QueryValueSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/function/QueryValueSource.java?rev=1091100&r1=1091099&r2=1091100&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/function/QueryValueSource.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/function/QueryValueSource.java Mon Apr 11 15:26:19 2011
@@ -77,6 +77,7 @@ class QueryDocValues extends DocValues {
 
   Scorer scorer;
   int scorerDoc; // the document the scorer is on
+  boolean noMatches = false;
 
   // the last document requested... start off with high value
   // to trigger a scorer reset on first access.
@@ -93,9 +94,12 @@ class QueryDocValues extends DocValues {
   public float floatVal(int doc) {
     try {
       if (doc < lastDocRequested) {
-        // out-of-order access.... reset scorer.
+        if (noMatches) return defVal;
         scorer = weight.scorer(reader, true, false);
-        if (scorer==null) return defVal;
+        if (scorer==null) {
+          noMatches = true;
+          return defVal;
+        }
         scorerDoc = -1;
       }
       lastDocRequested = doc;