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 2014/10/23 18:49:18 UTC

svn commit: r1633879 - in /lucene/dev/trunk/lucene: CHANGES.txt core/src/java/org/apache/lucene/search/DocValuesDocIdSet.java

Author: jpountz
Date: Thu Oct 23 16:49:17 2014
New Revision: 1633879

URL: http://svn.apache.org/r1633879
Log:
LUCENE-6022: DocValuesDocIdSet checks live docs before doc values.

Modified:
    lucene/dev/trunk/lucene/CHANGES.txt
    lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/DocValuesDocIdSet.java

Modified: lucene/dev/trunk/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/CHANGES.txt?rev=1633879&r1=1633878&r2=1633879&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/CHANGES.txt (original)
+++ lucene/dev/trunk/lucene/CHANGES.txt Thu Oct 23 16:49:17 2014
@@ -243,6 +243,9 @@ Optimizations
 * LUCENE-5983: CachingWrapperFilter now uses a new DocIdSet implementation
   called RoaringDocIdSet instead of WAH8DocIdSet. (Adrien Grand)
 
+* LUCENE-6022: DocValuesDocIdSet checks live docs before doc values.
+  (Adrien Grand)
+
 Build
 
 * LUCENE-5909: Smoke tester now has better command line parsing and

Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/DocValuesDocIdSet.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/DocValuesDocIdSet.java?rev=1633879&r1=1633878&r2=1633879&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/DocValuesDocIdSet.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/DocValuesDocIdSet.java Thu Oct 23 16:49:17 2014
@@ -27,8 +27,7 @@ import org.apache.lucene.util.FixedBitSe
  * of its iterator is very stupid and slow if the implementation of the
  * {@link #matchDoc} method is not optimized, as iterators simply increment
  * the document id until {@code matchDoc(int)} returns true. Because of this
- * {@code matchDoc(int)} must be as fast as possible and in no case do any
- * I/O.
+ * {@code matchDoc(int)} must be as fast as possible.
  * @lucene.internal
  */
 public abstract class DocValuesDocIdSet extends DocIdSet {
@@ -66,7 +65,7 @@ public abstract class DocValuesDocIdSet 
     } : new Bits() {
       @Override
       public boolean get(int docid) {
-        return matchDoc(docid) && acceptDocs.get(docid);
+        return acceptDocs.get(docid) && matchDoc(docid);
       }
 
       @Override
@@ -135,19 +134,13 @@ public abstract class DocValuesDocIdSet 
       
         @Override
         public int nextDoc() {
-          do {
-            doc++;
-            if (doc >= maxDoc) {
-              return doc = NO_MORE_DOCS;
-            }
-          } while (!(matchDoc(doc) && acceptDocs.get(doc)));
-          return doc;
+          return advance(doc + 1);
         }
       
         @Override
         public int advance(int target) {
           for(doc=target; doc<maxDoc; doc++) {
-            if (matchDoc(doc) && acceptDocs.get(doc)) {
+            if (acceptDocs.get(doc) && matchDoc(doc)) {
               return doc;
             }
           }