lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r794399 - /lucene/java/trunk/src/java/org/apache/lucene/search/DocIdSetIterator.java
Date Wed, 15 Jul 2009 20:21:53 GMT
Author: mikemccand
Date: Wed Jul 15 20:21:53 2009
New Revision: 794399

URL: http://svn.apache.org/viewvc?rev=794399&view=rev
Log:
LUCENE-1614: if a DISI doesn't implement advance, emulate it using skipTo

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/search/DocIdSetIterator.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/DocIdSetIterator.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/DocIdSetIterator.java?rev=794399&r1=794398&r2=794399&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/DocIdSetIterator.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/DocIdSetIterator.java Wed Jul 15 20:21:53
2009
@@ -142,8 +142,10 @@
    * @since 2.9
    */
   public int advance(int target) throws IOException {
-    while (nextDoc() < target) {}
-    return doc;
+    if (target == NO_MORE_DOCS) {
+      return doc = NO_MORE_DOCS;
+    }
+    return doc = skipTo(target) ? doc() : NO_MORE_DOCS;
   }
 
 }



Mime
View raw message