lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yo...@apache.org
Subject svn commit: r794714 - in /lucene/solr/trunk/src/java/org/apache/solr/search/function: FunctionQuery.java ValueSource.java
Date Thu, 16 Jul 2009 15:17:39 GMT
Author: yonik
Date: Thu Jul 16 15:17:39 2009
New Revision: 794714

URL: http://svn.apache.org/viewvc?rev=794714&view=rev
Log:
SOLR-1284: implement new DISI.advance

Modified:
    lucene/solr/trunk/src/java/org/apache/solr/search/function/FunctionQuery.java
    lucene/solr/trunk/src/java/org/apache/solr/search/function/ValueSource.java

Modified: lucene/solr/trunk/src/java/org/apache/solr/search/function/FunctionQuery.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/search/function/FunctionQuery.java?rev=794714&r1=794713&r2=794714&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/search/function/FunctionQuery.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/search/function/FunctionQuery.java Thu Jul
16 15:17:39 2009
@@ -107,6 +107,34 @@
       vals = func.getValues(reader);
     }
 
+    @Override
+    public int docID() {
+      return doc;
+    }
+
+    @Override
+    // instead of matching all docs, we could also embed a query.
+    // the score could either ignore the subscore, or boost it.
+    // Containment:  floatline(foo:myTerm, "myFloatField", 1.0, 0.0f)
+    // Boost:        foo:myTerm^floatline("myFloatField",1.0,0.0f)
+    public int nextDoc() throws IOException {
+      for(;;) {
+        ++doc;
+        if (doc>=maxDoc) {
+          return doc=NO_MORE_DOCS;
+        }
+        if (hasDeletions && reader.isDeleted(doc)) continue;
+        return doc;
+      }
+    }
+
+    @Override
+    public int advance(int target) throws IOException {
+      // this will work even if target==NO_MORE_DOCS
+      doc=target-1;
+      return nextDoc();
+    }
+
     // instead of matching all docs, we could also embed a query.
     // the score could either ignore the subscore, or boost it.
     // Containment:  floatline(foo:myTerm, "myFloatField", 1.0, 0.0f)

Modified: lucene/solr/trunk/src/java/org/apache/solr/search/function/ValueSource.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/search/function/ValueSource.java?rev=794714&r1=794713&r2=794714&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/search/function/ValueSource.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/search/function/ValueSource.java Thu Jul 16
15:17:39 2009
@@ -78,6 +78,27 @@
     return true;
   }
 
+  @Override
+  public int docID() {
+    return doc;
+  }
+
+  @Override
+  public int nextDoc() throws IOException {
+    for(;;) {
+      doc++;
+      if (doc >= maxDoc) return doc=NO_MORE_DOCS;
+      if (matches(doc)) return doc;
+    }
+  }
+
+  @Override
+  public int advance(int target) throws IOException {
+    // also works fine when target==NO_MORE_DOCS
+    doc = target-1;
+    return nextDoc();
+  }
+
   public int doc() {
     return doc;
   }



Mime
View raw message