lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpou...@apache.org
Subject svn commit: r1634012 [2/2] - in /lucene/dev/trunk: lucene/ lucene/codecs/src/java/org/apache/lucene/codecs/bloom/ lucene/core/src/java/org/apache/lucene/search/ lucene/core/src/java/org/apache/lucene/util/ lucene/core/src/test/org/apache/lucene/search/...
Date Fri, 24 Oct 2014 07:32:20 GMT
Modified: lucene/dev/trunk/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinFieldComparator.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinFieldComparator.java?rev=1634012&r1=1634011&r2=1634012&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinFieldComparator.java (original)
+++ lucene/dev/trunk/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinFieldComparator.java Fri Oct 24 07:32:19 2014
@@ -24,7 +24,6 @@ import org.apache.lucene.search.DocIdSet
 import org.apache.lucene.search.DocIdSetIterator;
 import org.apache.lucene.search.FieldComparator;
 import org.apache.lucene.search.Filter;
-import org.apache.lucene.util.FixedBitDocIdSet;
 import org.apache.lucene.util.FixedBitSet;
 
 /**
@@ -70,8 +69,8 @@ public abstract class ToParentBlockJoinF
     DocIdSet innerDocuments = childFilter.getDocIdSet(context, null);
     if (isEmpty(innerDocuments)) {
       this.childDocuments = null;
-    } else if (innerDocuments instanceof FixedBitDocIdSet) {
-      this.childDocuments = ((FixedBitDocIdSet) innerDocuments).bits();
+    } else if (innerDocuments.bits() instanceof FixedBitSet) {
+      this.childDocuments = (FixedBitSet) innerDocuments.bits();
     } else {
       DocIdSetIterator iterator = innerDocuments.iterator();
       if (iterator != null) {
@@ -83,8 +82,8 @@ public abstract class ToParentBlockJoinF
     DocIdSet rootDocuments = parentFilter.getDocIdSet(context, null);
     if (isEmpty(rootDocuments)) {
       this.parentDocuments = null;
-    } else if (rootDocuments instanceof FixedBitDocIdSet) {
-      this.parentDocuments = ((FixedBitDocIdSet) rootDocuments).bits();
+    } else if (rootDocuments.bits() instanceof FixedBitSet) {
+      this.parentDocuments = (FixedBitSet) rootDocuments.bits();
     } else {
       DocIdSetIterator iterator = rootDocuments.iterator();
       if (iterator != null) {
@@ -144,7 +143,7 @@ public abstract class ToParentBlockJoinF
       // We need to copy the lowest value from all child docs into slot.
       int prevParentDoc = parentDocuments.prevSetBit(parentDoc - 1);
       int childDoc = childDocuments.nextSetBit(prevParentDoc + 1);
-      if (childDoc >= parentDoc || childDoc == -1) {
+      if (childDoc >= parentDoc || childDoc == DocIdSetIterator.NO_MORE_DOCS) {
         return 0;
       }
 
@@ -156,7 +155,7 @@ public abstract class ToParentBlockJoinF
 
       while (true) {
         childDoc = childDocuments.nextSetBit(childDoc + 1);
-        if (childDoc >= parentDoc || childDoc == -1) {
+        if (childDoc >= parentDoc || childDoc == DocIdSetIterator.NO_MORE_DOCS) {
           return cmp;
         }
         int cmp1 = wrappedComparator.compareBottom(childDoc);
@@ -179,7 +178,7 @@ public abstract class ToParentBlockJoinF
       // We need to copy the lowest value from all child docs into slot.
       int prevParentDoc = parentDocuments.prevSetBit(parentDoc - 1);
       int childDoc = childDocuments.nextSetBit(prevParentDoc + 1);
-      if (childDoc >= parentDoc || childDoc == -1) {
+      if (childDoc >= parentDoc || childDoc == DocIdSetIterator.NO_MORE_DOCS) {
         return;
       }
       wrappedComparator.copy(spareSlot, childDoc);
@@ -187,7 +186,7 @@ public abstract class ToParentBlockJoinF
 
       while (true) {
         childDoc = childDocuments.nextSetBit(childDoc + 1);
-        if (childDoc >= parentDoc || childDoc == -1) {
+        if (childDoc >= parentDoc || childDoc == DocIdSetIterator.NO_MORE_DOCS) {
           return;
         }
         wrappedComparator.copy(spareSlot, childDoc);
@@ -207,7 +206,7 @@ public abstract class ToParentBlockJoinF
       // We need to copy the lowest value from all nested docs into slot.
       int prevParentDoc = parentDocuments.prevSetBit(parentDoc - 1);
       int childDoc = childDocuments.nextSetBit(prevParentDoc + 1);
-      if (childDoc >= parentDoc || childDoc == -1) {
+      if (childDoc >= parentDoc || childDoc == DocIdSetIterator.NO_MORE_DOCS) {
         return 0;
       }
 
@@ -219,7 +218,7 @@ public abstract class ToParentBlockJoinF
 
       while (true) {
         childDoc = childDocuments.nextSetBit(childDoc + 1);
-        if (childDoc >= parentDoc || childDoc == -1) {
+        if (childDoc >= parentDoc || childDoc == DocIdSetIterator.NO_MORE_DOCS) {
           return cmp;
         }
         int cmp1 = wrappedComparator.compareTop(childDoc);
@@ -262,7 +261,7 @@ public abstract class ToParentBlockJoinF
 
       int prevParentDoc = parentDocuments.prevSetBit(parentDoc - 1);
       int childDoc = childDocuments.nextSetBit(prevParentDoc + 1);
-      if (childDoc >= parentDoc || childDoc == -1) {
+      if (childDoc >= parentDoc || childDoc == DocIdSetIterator.NO_MORE_DOCS) {
         return 0;
       }
 
@@ -273,7 +272,7 @@ public abstract class ToParentBlockJoinF
 
       while (true) {
         childDoc = childDocuments.nextSetBit(childDoc + 1);
-        if (childDoc >= parentDoc || childDoc == -1) {
+        if (childDoc >= parentDoc || childDoc == DocIdSetIterator.NO_MORE_DOCS) {
           return cmp;
         }
         int cmp1 = wrappedComparator.compareBottom(childDoc);
@@ -295,7 +294,7 @@ public abstract class ToParentBlockJoinF
 
       int prevParentDoc = parentDocuments.prevSetBit(parentDoc - 1);
       int childDoc = childDocuments.nextSetBit(prevParentDoc + 1);
-      if (childDoc >= parentDoc || childDoc == -1) {
+      if (childDoc >= parentDoc || childDoc == DocIdSetIterator.NO_MORE_DOCS) {
         return;
       }
       wrappedComparator.copy(spareSlot, childDoc);
@@ -303,7 +302,7 @@ public abstract class ToParentBlockJoinF
 
       while (true) {
         childDoc = childDocuments.nextSetBit(childDoc + 1);
-        if (childDoc >= parentDoc || childDoc == -1) {
+        if (childDoc >= parentDoc || childDoc == DocIdSetIterator.NO_MORE_DOCS) {
           return;
         }
         wrappedComparator.copy(spareSlot, childDoc);
@@ -322,7 +321,7 @@ public abstract class ToParentBlockJoinF
 
       int prevParentDoc = parentDocuments.prevSetBit(parentDoc - 1);
       int childDoc = childDocuments.nextSetBit(prevParentDoc + 1);
-      if (childDoc >= parentDoc || childDoc == -1) {
+      if (childDoc >= parentDoc || childDoc == DocIdSetIterator.NO_MORE_DOCS) {
         return 0;
       }
 
@@ -333,7 +332,7 @@ public abstract class ToParentBlockJoinF
 
       while (true) {
         childDoc = childDocuments.nextSetBit(childDoc + 1);
-        if (childDoc >= parentDoc || childDoc == -1) {
+        if (childDoc >= parentDoc || childDoc == DocIdSetIterator.NO_MORE_DOCS) {
           return cmp;
         }
         int cmp1 = wrappedComparator.compareTop(childDoc);

Modified: lucene/dev/trunk/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinQuery.java?rev=1634012&r1=1634011&r2=1634012&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinQuery.java (original)
+++ lucene/dev/trunk/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinQuery.java Fri Oct 24 07:32:19 2014
@@ -39,7 +39,6 @@ import org.apache.lucene.search.Weight;
 import org.apache.lucene.search.grouping.TopGroups;
 import org.apache.lucene.util.ArrayUtil;
 import org.apache.lucene.util.Bits;
-import org.apache.lucene.util.FixedBitDocIdSet;
 import org.apache.lucene.util.FixedBitSet;
 
 /**
@@ -184,11 +183,11 @@ public class ToParentBlockJoinQuery exte
         // No matches
         return null;
       }
-      if (!(parents instanceof FixedBitDocIdSet)) {
-        throw new IllegalStateException("parentFilter must return FixedBitSet; got " + parents);
+      if (!(parents.bits() instanceof FixedBitSet)) {
+        throw new IllegalStateException("parentFilter must return FixedBitSet; got " + parents.bits());
       }
 
-      return new BlockJoinScorer(this, childScorer, ((FixedBitDocIdSet) parents).bits(), firstChildDoc, scoreMode, acceptDocs);
+      return new BlockJoinScorer(this, childScorer, (FixedBitSet) parents.bits(), firstChildDoc, scoreMode, acceptDocs);
     }
 
     @Override
@@ -288,7 +287,7 @@ public class ToParentBlockJoinQuery exte
         }
 
         //System.out.println("  parentDoc=" + parentDoc);
-        assert parentDoc != -1;
+        assert parentDoc != DocIdSetIterator.NO_MORE_DOCS;
 
         //System.out.println("  nextChildDoc=" + nextChildDoc);
         if (acceptDocs != null && !acceptDocs.get(parentDoc)) {

Modified: lucene/dev/trunk/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java?rev=1634012&r1=1634011&r2=1634012&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java (original)
+++ lucene/dev/trunk/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java Fri Oct 24 07:32:19 2014
@@ -64,10 +64,10 @@ import org.apache.lucene.search.TermQuer
 import org.apache.lucene.search.TopDocs;
 import org.apache.lucene.search.TopScoreDocCollector;
 import org.apache.lucene.store.Directory;
+import org.apache.lucene.util.BitSetIterator;
 import org.apache.lucene.util.Bits;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.FixedBitSet;
-import org.apache.lucene.util.FixedBitSet.FixedBitSetIterator;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.TestUtil;
 import org.junit.Test;
@@ -505,12 +505,12 @@ public class TestJoinUtil extends Lucene
         // Asserting bit set...
         if (VERBOSE) {
           System.out.println("expected cardinality:" + expectedResult.cardinality());
-          DocIdSetIterator iterator = new FixedBitSetIterator(expectedResult, expectedResult.cardinality());
+          DocIdSetIterator iterator = new BitSetIterator(expectedResult, expectedResult.cardinality());
           for (int doc = iterator.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = iterator.nextDoc()) {
             System.out.println(String.format(Locale.ROOT, "Expected doc[%d] with id value %s", doc, indexSearcher.doc(doc).get("id")));
           }
           System.out.println("actual cardinality:" + actualResult.cardinality());
-          iterator = new FixedBitSetIterator(actualResult, actualResult.cardinality());
+          iterator = new BitSetIterator(actualResult, actualResult.cardinality());
           for (int doc = iterator.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = iterator.nextDoc()) {
             System.out.println(String.format(Locale.ROOT, "Actual doc[%d] with id value %s", doc, indexSearcher.doc(doc).get("id")));
           }

Modified: lucene/dev/trunk/lucene/misc/src/java/org/apache/lucene/index/PKIndexSplitter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/misc/src/java/org/apache/lucene/index/PKIndexSplitter.java?rev=1634012&r1=1634011&r2=1634012&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/misc/src/java/org/apache/lucene/index/PKIndexSplitter.java (original)
+++ lucene/dev/trunk/lucene/misc/src/java/org/apache/lucene/index/PKIndexSplitter.java Fri Oct 24 07:32:19 2014
@@ -26,9 +26,9 @@ import org.apache.lucene.search.DocIdSet
 import org.apache.lucene.search.Filter;
 import org.apache.lucene.search.TermRangeFilter;
 import org.apache.lucene.store.Directory;
+import org.apache.lucene.util.BitSetIterator;
 import org.apache.lucene.util.Bits;
 import org.apache.lucene.util.FixedBitSet;
-import org.apache.lucene.util.FixedBitSet.FixedBitSetIterator;
 import org.apache.lucene.util.IOUtils;
 
 /**
@@ -142,7 +142,7 @@ public class PKIndexSplitter {
       if (in.hasDeletions()) {
         final Bits oldLiveDocs = in.getLiveDocs();
         assert oldLiveDocs != null;
-        final DocIdSetIterator it = new FixedBitSetIterator(bits, 0L); // the cost is not useful here
+        final DocIdSetIterator it = new BitSetIterator(bits, 0L); // the cost is not useful here
         for (int i = it.nextDoc(); i < maxDoc; i = it.nextDoc()) {
           if (!oldLiveDocs.get(i)) {
             // we can safely modify the current bit, as the iterator already stepped over it:

Modified: lucene/dev/trunk/lucene/misc/src/java/org/apache/lucene/index/sorter/BlockJoinComparatorSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/misc/src/java/org/apache/lucene/index/sorter/BlockJoinComparatorSource.java?rev=1634012&r1=1634011&r2=1634012&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/misc/src/java/org/apache/lucene/index/sorter/BlockJoinComparatorSource.java (original)
+++ lucene/dev/trunk/lucene/misc/src/java/org/apache/lucene/index/sorter/BlockJoinComparatorSource.java Fri Oct 24 07:32:19 2014
@@ -30,7 +30,7 @@ import org.apache.lucene.search.ScoreDoc
 import org.apache.lucene.search.Scorer;
 import org.apache.lucene.search.Sort;
 import org.apache.lucene.search.SortField;
-import org.apache.lucene.util.FixedBitDocIdSet;
+import org.apache.lucene.util.BitDocIdSet;
 import org.apache.lucene.util.FixedBitSet;
 
 /**
@@ -149,7 +149,7 @@ public class BlockJoinComparatorSource e
         if (parents == null) {
           throw new IllegalStateException("LeafReader " + context.reader() + " contains no parents!");
         }
-        if (!(parents instanceof FixedBitDocIdSet)) {
+        if (!(parents instanceof BitDocIdSet)) {
           throw new IllegalStateException("parentFilter must return FixedBitSet; got " + parents);
         }
         parentBits = (FixedBitSet) parents.bits();

Modified: lucene/dev/trunk/lucene/misc/src/test/org/apache/lucene/index/sorter/TestBlockJoinSorter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/misc/src/test/org/apache/lucene/index/sorter/TestBlockJoinSorter.java?rev=1634012&r1=1634011&r2=1634012&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/misc/src/test/org/apache/lucene/index/sorter/TestBlockJoinSorter.java (original)
+++ lucene/dev/trunk/lucene/misc/src/test/org/apache/lucene/index/sorter/TestBlockJoinSorter.java Fri Oct 24 07:32:19 2014
@@ -41,7 +41,7 @@ import org.apache.lucene.search.Sort;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.search.TermQuery;
 import org.apache.lucene.util.ArrayUtil;
-import org.apache.lucene.util.FixedBitDocIdSet;
+import org.apache.lucene.util.BitDocIdSet;
 import org.apache.lucene.util.FixedBitSet;
 import org.apache.lucene.util.LuceneTestCase;
 
@@ -58,7 +58,7 @@ public class TestBlockJoinSorter extends
         throws IOException {
       final FixedBitSet cached = new FixedBitSet(reader.maxDoc());
       cached.or(iterator);
-      return new FixedBitDocIdSet(cached);
+      return new BitDocIdSet(cached);
     }
 
   }

Modified: lucene/dev/trunk/lucene/misc/src/test/org/apache/lucene/uninverting/TestFieldCacheSortRandom.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/misc/src/test/org/apache/lucene/uninverting/TestFieldCacheSortRandom.java?rev=1634012&r1=1634011&r2=1634012&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/misc/src/test/org/apache/lucene/uninverting/TestFieldCacheSortRandom.java (original)
+++ lucene/dev/trunk/lucene/misc/src/test/org/apache/lucene/uninverting/TestFieldCacheSortRandom.java Fri Oct 24 07:32:19 2014
@@ -52,7 +52,7 @@ import org.apache.lucene.store.Directory
 import org.apache.lucene.uninverting.UninvertingReader.Type;
 import org.apache.lucene.util.Bits;
 import org.apache.lucene.util.BytesRef;
-import org.apache.lucene.util.FixedBitDocIdSet;
+import org.apache.lucene.util.BitDocIdSet;
 import org.apache.lucene.util.FixedBitSet;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.TestUtil;
@@ -291,7 +291,7 @@ public class TestFieldCacheSortRandom ex
         }
       }
 
-      return new FixedBitDocIdSet(bits);
+      return new BitDocIdSet(bits);
     }
   }
 }

Modified: lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/BooleanFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/BooleanFilter.java?rev=1634012&r1=1634011&r2=1634012&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/BooleanFilter.java (original)
+++ lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/BooleanFilter.java Fri Oct 24 07:32:19 2014
@@ -30,8 +30,7 @@ import org.apache.lucene.search.DocIdSet
 import org.apache.lucene.search.DocIdSetIterator;
 import org.apache.lucene.search.Filter;
 import org.apache.lucene.util.Bits;
-import org.apache.lucene.util.FixedBitDocIdSet;
-import org.apache.lucene.util.FixedBitSet;
+import org.apache.lucene.util.DocIdSetBuilder;
 
 /**
  * A container Filter that allows Boolean composition of Filters.
@@ -52,7 +51,7 @@ public class BooleanFilter extends Filte
    */
   @Override
   public DocIdSet getDocIdSet(LeafReaderContext context, Bits acceptDocs) throws IOException {
-    FixedBitSet res = null;
+    DocIdSetBuilder res = null;
     final LeafReader reader = context.reader();
     
     boolean hasShouldClauses = false;
@@ -62,7 +61,7 @@ public class BooleanFilter extends Filte
         final DocIdSetIterator disi = getDISI(fc.getFilter(), context);
         if (disi == null) continue;
         if (res == null) {
-          res = new FixedBitSet(reader.maxDoc());
+          res = new DocIdSetBuilder(reader.maxDoc());
         }
         res.or(disi);
       }
@@ -74,8 +73,7 @@ public class BooleanFilter extends Filte
       if (fc.getOccur() == Occur.MUST_NOT) {
         if (res == null) {
           assert !hasShouldClauses;
-          res = new FixedBitSet(reader.maxDoc());
-          res.set(0, reader.maxDoc()); // NOTE: may set bits on deleted docs
+          res = new DocIdSetBuilder(reader.maxDoc(), true); // NOTE: may set bits on deleted docs
         }
         final DocIdSetIterator disi = getDISI(fc.getFilter(), context);
         if (disi != null) {
@@ -91,7 +89,7 @@ public class BooleanFilter extends Filte
           return null; // no documents can match
         }
         if (res == null) {
-          res = new FixedBitSet(reader.maxDoc());
+          res = new DocIdSetBuilder(reader.maxDoc());
           res.or(disi);
         } else {
           res.and(disi);
@@ -102,7 +100,7 @@ public class BooleanFilter extends Filte
     if (res == null) {
       return null;
     }
-    return BitsFilteredDocIdSet.wrap(new FixedBitDocIdSet(res), acceptDocs);
+    return BitsFilteredDocIdSet.wrap(res.build(), acceptDocs);
   }
 
   private static DocIdSetIterator getDISI(Filter filter, LeafReaderContext context)

Modified: lucene/dev/trunk/lucene/queries/src/test/org/apache/lucene/queries/BooleanFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/queries/src/test/org/apache/lucene/queries/BooleanFilterTest.java?rev=1634012&r1=1634011&r2=1634012&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/queries/src/test/org/apache/lucene/queries/BooleanFilterTest.java (original)
+++ lucene/dev/trunk/lucene/queries/src/test/org/apache/lucene/queries/BooleanFilterTest.java Fri Oct 24 07:32:19 2014
@@ -37,7 +37,7 @@ import org.apache.lucene.search.TermQuer
 import org.apache.lucene.search.TermRangeFilter;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.Bits;
-import org.apache.lucene.util.FixedBitDocIdSet;
+import org.apache.lucene.util.BitDocIdSet;
 import org.apache.lucene.util.FixedBitSet;
 import org.apache.lucene.util.LuceneTestCase;
 
@@ -94,7 +94,7 @@ public class BooleanFilterTest extends L
     return new Filter() {
       @Override
       public DocIdSet getDocIdSet(LeafReaderContext context, Bits acceptDocs) {
-        return new FixedBitDocIdSet(new FixedBitSet(context.reader().maxDoc()));
+        return new BitDocIdSet(new FixedBitSet(context.reader().maxDoc()));
       }
     };
   }

Modified: lucene/dev/trunk/lucene/queries/src/test/org/apache/lucene/queries/TermsFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/queries/src/test/org/apache/lucene/queries/TermsFilterTest.java?rev=1634012&r1=1634011&r2=1634012&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/queries/src/test/org/apache/lucene/queries/TermsFilterTest.java (original)
+++ lucene/dev/trunk/lucene/queries/src/test/org/apache/lucene/queries/TermsFilterTest.java Fri Oct 24 07:32:19 2014
@@ -47,7 +47,7 @@ import org.apache.lucene.search.TermQuer
 import org.apache.lucene.search.TopDocs;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.BytesRef;
-import org.apache.lucene.util.FixedBitDocIdSet;
+import org.apache.lucene.util.BitDocIdSet;
 import org.apache.lucene.util.FixedBitSet;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.TestUtil;
@@ -82,19 +82,19 @@ public class TermsFilterTest extends Luc
 
     List<Term> terms = new ArrayList<>();
     terms.add(new Term(fieldName, "19"));
-    FixedBitDocIdSet bits = (FixedBitDocIdSet) termsFilter(random().nextBoolean(), terms).getDocIdSet(context, context.reader().getLiveDocs());
+    BitDocIdSet bits = (BitDocIdSet) termsFilter(random().nextBoolean(), terms).getDocIdSet(context, context.reader().getLiveDocs());
     assertNull("Must match nothing", bits);
 
     terms.add(new Term(fieldName, "20"));
-    bits = (FixedBitDocIdSet) termsFilter(random().nextBoolean(), terms).getDocIdSet(context, context.reader().getLiveDocs());
+    bits = (BitDocIdSet) termsFilter(random().nextBoolean(), terms).getDocIdSet(context, context.reader().getLiveDocs());
     assertEquals("Must match 1", 1, bits.bits().cardinality());
 
     terms.add(new Term(fieldName, "10"));
-    bits = (FixedBitDocIdSet) termsFilter(random().nextBoolean(), terms).getDocIdSet(context, context.reader().getLiveDocs());
+    bits = (BitDocIdSet) termsFilter(random().nextBoolean(), terms).getDocIdSet(context, context.reader().getLiveDocs());
     assertEquals("Must match 2", 2, bits.bits().cardinality());
 
     terms.add(new Term(fieldName, "00"));
-    bits = (FixedBitDocIdSet) termsFilter(random().nextBoolean(), terms).getDocIdSet(context, context.reader().getLiveDocs());
+    bits = (BitDocIdSet) termsFilter(random().nextBoolean(), terms).getDocIdSet(context, context.reader().getLiveDocs());
     assertEquals("Must match 2", 2, bits.bits().cardinality());
 
     reader.close();
@@ -127,7 +127,7 @@ public class TermsFilterTest extends Luc
       if (context.reader().docFreq(new Term(fieldName, "content1")) == 0) {
         assertNull(docIdSet);
       } else {
-        FixedBitDocIdSet bits = (FixedBitDocIdSet) docIdSet;
+        BitDocIdSet bits = (BitDocIdSet) docIdSet;
         assertTrue("Must be >= 0", bits.bits().cardinality() >= 0);      
       }
     }
@@ -164,7 +164,7 @@ public class TermsFilterTest extends Luc
     LeafReaderContext context = reader.leaves().get(0);
     TermsFilter tf = new TermsFilter(terms);
 
-    FixedBitDocIdSet bits = (FixedBitDocIdSet) tf.getDocIdSet(context, context.reader().getLiveDocs());
+    BitDocIdSet bits = (BitDocIdSet) tf.getDocIdSet(context, context.reader().getLiveDocs());
     assertEquals("Must be num fields - 1 since we skip only one field", num-1, bits.bits().cardinality());  
     reader.close();
     dir.close();
@@ -200,7 +200,7 @@ public class TermsFilterTest extends Luc
     LeafReaderContext context = reader.leaves().get(0);
     TermsFilter tf = new TermsFilter(new ArrayList<>(terms));
 
-    FixedBitDocIdSet bits = (FixedBitDocIdSet) tf.getDocIdSet(context, context.reader().getLiveDocs());
+    BitDocIdSet bits = (BitDocIdSet) tf.getDocIdSet(context, context.reader().getLiveDocs());
     assertEquals(context.reader().numDocs(), bits.bits().cardinality());  
     reader.close();
     dir.close();

Modified: lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/sandbox/queries/DuplicateFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/sandbox/queries/DuplicateFilter.java?rev=1634012&r1=1634011&r2=1634012&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/sandbox/queries/DuplicateFilter.java (original)
+++ lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/sandbox/queries/DuplicateFilter.java Fri Oct 24 07:32:19 2014
@@ -27,11 +27,10 @@ import org.apache.lucene.index.TermsEnum
 import org.apache.lucene.search.DocIdSet;
 import org.apache.lucene.search.DocIdSetIterator;
 import org.apache.lucene.search.Filter;
+import org.apache.lucene.util.BitDocIdSet;
 import org.apache.lucene.util.Bits;
 import org.apache.lucene.util.BytesRef;
-import org.apache.lucene.util.FixedBitDocIdSet;
 import org.apache.lucene.util.FixedBitSet;
-import org.apache.lucene.util.SparseFixedBitDocIdSet;
 import org.apache.lucene.util.SparseFixedBitSet;
 
 /**
@@ -127,7 +126,7 @@ public class DuplicateFilter extends Fil
         }
       }
     }
-    return new SparseFixedBitDocIdSet(bits, bits.approximateCardinality());
+    return new BitDocIdSet(bits, bits.approximateCardinality());
   }
 
   private DocIdSet fastBits(LeafReader reader, Bits acceptDocs) throws IOException {
@@ -172,7 +171,7 @@ public class DuplicateFilter extends Fil
       }
     }
 
-    return new FixedBitDocIdSet(bits);
+    return new BitDocIdSet(bits);
   }
 
   public String getFieldName() {

Modified: lucene/dev/trunk/lucene/sandbox/src/test/org/apache/lucene/search/TestTermAutomatonQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/sandbox/src/test/org/apache/lucene/search/TestTermAutomatonQuery.java?rev=1634012&r1=1634011&r2=1634012&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/sandbox/src/test/org/apache/lucene/search/TestTermAutomatonQuery.java (original)
+++ lucene/dev/trunk/lucene/sandbox/src/test/org/apache/lucene/search/TestTermAutomatonQuery.java Fri Oct 24 07:32:19 2014
@@ -46,7 +46,7 @@ import org.apache.lucene.index.Term;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.Bits;
 import org.apache.lucene.util.BytesRef;
-import org.apache.lucene.util.FixedBitDocIdSet;
+import org.apache.lucene.util.BitDocIdSet;
 import org.apache.lucene.util.FixedBitSet;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.TestUtil;
@@ -638,7 +638,7 @@ public class TestTermAutomatonQuery exte
         }
       }
 
-      return new FixedBitDocIdSet(bits);
+      return new BitDocIdSet(bits);
     }
   }
 }

Modified: lucene/dev/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/IntersectsPrefixTreeFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/IntersectsPrefixTreeFilter.java?rev=1634012&r1=1634011&r2=1634012&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/IntersectsPrefixTreeFilter.java (original)
+++ lucene/dev/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/IntersectsPrefixTreeFilter.java Fri Oct 24 07:32:19 2014
@@ -25,7 +25,7 @@ import org.apache.lucene.search.DocIdSet
 import org.apache.lucene.spatial.prefix.tree.Cell;
 import org.apache.lucene.spatial.prefix.tree.SpatialPrefixTree;
 import org.apache.lucene.util.Bits;
-import org.apache.lucene.util.FixedBitDocIdSet;
+import org.apache.lucene.util.BitDocIdSet;
 import org.apache.lucene.util.FixedBitSet;
 
 import java.io.IOException;
@@ -73,7 +73,7 @@ public class IntersectsPrefixTreeFilter 
 
       @Override
       protected DocIdSet finish() {
-        return new FixedBitDocIdSet(results);
+        return new BitDocIdSet(results);
       }
 
       @Override

Modified: lucene/dev/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/WithinPrefixTreeFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/WithinPrefixTreeFilter.java?rev=1634012&r1=1634011&r2=1634012&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/WithinPrefixTreeFilter.java (original)
+++ lucene/dev/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/WithinPrefixTreeFilter.java Fri Oct 24 07:32:19 2014
@@ -25,7 +25,7 @@ import org.apache.lucene.spatial.prefix.
 import org.apache.lucene.spatial.prefix.tree.CellIterator;
 import org.apache.lucene.spatial.prefix.tree.SpatialPrefixTree;
 import org.apache.lucene.util.Bits;
-import org.apache.lucene.util.FixedBitDocIdSet;
+import org.apache.lucene.util.BitDocIdSet;
 import org.apache.lucene.util.FixedBitSet;
 
 import com.spatial4j.core.context.SpatialContext;
@@ -136,7 +136,7 @@ public class WithinPrefixTreeFilter exte
       @Override
       protected DocIdSet finish() {
         inside.andNot(outside);
-        return new FixedBitDocIdSet(inside);
+        return new BitDocIdSet(inside);
       }
 
       @Override

Added: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/BaseBitSetTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/BaseBitSetTestCase.java?rev=1634012&view=auto
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/BaseBitSetTestCase.java (added)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/BaseBitSetTestCase.java Fri Oct 24 07:32:19 2014
@@ -0,0 +1,235 @@
+package org.apache.lucene.util;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.IOException;
+import java.util.Collections;
+
+import org.apache.lucene.search.DocIdSet;
+import org.apache.lucene.search.DocIdSetIterator;
+import org.junit.Ignore;
+
+/**
+ * Base test case for BitSets.
+ */
+@Ignore
+public abstract class BaseBitSetTestCase<T extends BitSet> extends LuceneTestCase {
+
+  /** Create a copy of the given {@link BitSet} which has <code>length</code> bits. */
+  public abstract T copyOf(BitSet bs, int length) throws IOException;
+
+  /** Create a random set which has <code>numBitsSet</code> of its <code>numBits</code> bits set. */
+  static java.util.BitSet randomSet(int numBits, int numBitsSet) {
+    assert numBitsSet <= numBits;
+    final java.util.BitSet set = new java.util.BitSet(numBits);
+    if (numBitsSet == numBits) {
+      set.set(0, numBits);
+    } else {
+      for (int i = 0; i < numBitsSet; ++i) {
+        while (true) {
+          final int o = random().nextInt(numBits);
+          if (!set.get(o)) {
+            set.set(o);
+            break;
+          }
+        }
+      }
+    }
+    return set;
+  }
+
+  /** Same as {@link #randomSet(int, int)} but given a load factor. */
+  static java.util.BitSet randomSet(int numBits, float percentSet) {
+    return randomSet(numBits, (int) (percentSet * numBits));
+  }
+
+  private void assertEquals(BitSet set1, BitSet set2, int maxDoc) {
+    for (int i = 0; i < maxDoc; ++i) {
+      assertEquals("Different at " + i, set1.get(i), set2.get(i));
+    }
+  }
+
+  /** Test the {@link BitSet#cardinality()} method. */
+  public void testCardinality() throws IOException {
+    final int numBits = 1 + random().nextInt(100000);
+    for (float percentSet : new float[] {0, 0.01f, 0.1f, 0.5f, 0.9f, 0.99f, 1f}) {
+      BitSet set1 = new JavaUtilBitSet(randomSet(numBits, percentSet), numBits);
+      T set2 = copyOf(set1, numBits);
+      assertEquals(set1.cardinality(), set2.cardinality());
+    }
+  }
+
+  /** Test the {@link BitSet#set} method. */
+  public void testSet() throws IOException {
+    final int numBits = 1 + random().nextInt(100000);
+    for (float percentSet : new float[] {0, 0.01f, 0.1f, 0.5f, 0.9f, 0.99f, 1f}) {
+      BitSet set1 = new JavaUtilBitSet(randomSet(numBits, percentSet), numBits);
+      T set2 = copyOf(set1, numBits);
+      assertEquals(set1, set2, numBits);
+    }
+  }
+
+  /** Test the {@link BitSet#clear(int)} method. */
+  public void testClear() throws IOException {
+    final int numBits = 1 + random().nextInt(100000);
+    for (float percentSet : new float[] {0, 0.01f, 0.1f, 0.5f, 0.9f, 0.99f, 1f}) {
+      BitSet set1 = new JavaUtilBitSet(randomSet(numBits, percentSet), numBits);
+      T set2 = copyOf(set1, numBits);
+      final int iters = 1 + random().nextInt(numBits * 2);
+      for (int i = 0; i < iters; ++i) {
+        final int index = random().nextInt(numBits);
+        set1.clear(index);
+        set2.clear(index);
+      }
+      assertEquals(set1, set2, numBits);
+    }
+  }
+
+  /** Test the {@link BitSet#clear(int,int)} method. */
+  public void testClearRange() throws IOException {
+    final int numBits = 1 + random().nextInt(100000);
+    for (float percentSet : new float[] {0, 0.01f, 0.1f, 0.5f, 0.9f, 0.99f, 1f}) {
+      BitSet set1 = new JavaUtilBitSet(randomSet(numBits, percentSet), numBits);
+      T set2 = copyOf(set1, numBits);
+      final int iters = 1 + random().nextInt(100);
+      for (int i = 0; i < iters; ++i) {
+        final int from = random().nextInt(numBits);
+        final int to = random().nextInt(numBits + 1);
+        set1.clear(from, to);
+        set2.clear(from, to);
+        assertEquals(set1, set2, numBits);
+      }
+    }
+  }
+
+  private DocIdSet randomCopy(BitSet set, int numBits) throws IOException {
+    if (random().nextBoolean()) {
+      return new BitDocIdSet(copyOf(set, numBits), set.cardinality());
+    } else if (random().nextBoolean()) {
+      final RoaringDocIdSet.Builder builder = new RoaringDocIdSet.Builder(numBits);
+      for (int i = set.nextSetBit(0); i != DocIdSetIterator.NO_MORE_DOCS; i = i + 1 >= numBits ? DocIdSetIterator.NO_MORE_DOCS : set.nextSetBit(i + 1)) {
+        builder.add(i);
+      }
+      return builder.build();
+    } else {
+      return new BitDocIdSet(set, set.cardinality());
+    }
+  }
+
+  /** Test the {@link BitSet#and}, {@link BitSet#or} and {@link BitSet#andNot} methods. */
+  public void testBulkOperations() throws IOException {
+    final int numBits = 1 + random().nextInt(100000);
+    BitSet set1 = new JavaUtilBitSet(randomSet(numBits, 0), numBits);
+    T set2 = copyOf(set1, numBits);
+    final int iters = 10 + random().nextInt(100);
+    for (int i = 0; i < iters; ++i) {
+      // make extreme percents more likely
+      float percentSet2 = (float) Math.pow(random().nextDouble(), 2);
+      if (random().nextBoolean()) {
+        percentSet2 = 1 - percentSet2;
+      }
+      BitSet bulkSet = new JavaUtilBitSet(randomSet(numBits, percentSet2), numBits);
+      // operations are sometimes specialized based on the impl, so randomize the impl
+      final DocIdSet bulkSetCopy = randomCopy(bulkSet, numBits);
+      // now randomize the operation
+      if (bulkSetCopy.iterator() == null) {
+        continue;
+      }
+      switch (random().nextInt(3)) {
+        case 0:
+          set1.or(bulkSetCopy.iterator());
+          set2.or(bulkSetCopy.iterator());
+          break;
+        case 1:
+          set1.and(bulkSetCopy.iterator());
+          set2.and(bulkSetCopy.iterator());
+          break;
+        default:
+          set1.andNot(bulkSetCopy.iterator());
+          set2.andNot(bulkSetCopy.iterator());
+          break;
+      }
+      assertEquals(set1, set2, numBits);
+    }
+  }
+
+  private static class JavaUtilBitSet extends BitSet {
+
+    private final java.util.BitSet bitSet;
+    private final int numBits;
+
+    JavaUtilBitSet(java.util.BitSet bitSet, int numBits) {
+      this.bitSet = bitSet;
+      this.numBits = numBits;
+    }
+
+    @Override
+    public void clear(int index) {
+      bitSet.clear(index);
+    }
+
+    @Override
+    public boolean get(int index) {
+      return bitSet.get(index);
+    }
+
+    @Override
+    public int length() {
+      return numBits;
+    }
+
+    @Override
+    public long ramBytesUsed() {
+      return -1;
+    }
+
+    @Override
+    public Iterable<? extends Accountable> getChildResources() {
+      return Collections.emptyList();
+    }
+
+    @Override
+    public void set(int i) {
+      bitSet.set(i);
+    }
+
+    @Override
+    public void clear(int startIndex, int endIndex) {
+      if (startIndex >= endIndex) {
+        return;
+      }
+      bitSet.clear(startIndex, endIndex);
+    }
+
+    @Override
+    public int cardinality() {
+      return bitSet.cardinality();
+    }
+
+    @Override
+    public int nextSetBit(int i) {
+      int next = bitSet.nextSetBit(i);
+      if (next == -1) {
+        next = DocIdSetIterator.NO_MORE_DOCS;
+      }
+      return next;
+    }
+
+  }
+
+}

Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/BaseDocIdSetTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/BaseDocIdSetTestCase.java?rev=1634012&r1=1634011&r2=1634012&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/BaseDocIdSetTestCase.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/BaseDocIdSetTestCase.java Fri Oct 24 07:32:19 2014
@@ -17,6 +17,8 @@ package org.apache.lucene.util;
  * limitations under the License.
  */
 
+import static org.apache.lucene.util.BaseBitSetTestCase.randomSet;
+
 import java.io.IOException;
 import java.util.BitSet;
 
@@ -29,31 +31,6 @@ public abstract class BaseDocIdSetTestCa
   /** Create a copy of the given {@link BitSet} which has <code>length</code> bits. */
   public abstract T copyOf(BitSet bs, int length) throws IOException;
 
-  /** Create a random set which has <code>numBitsSet</code> of its <code>numBits</code> bits set. */
-  protected static BitSet randomSet(int numBits, int numBitsSet) {
-    assert numBitsSet <= numBits;
-    final BitSet set = new BitSet(numBits);
-    if (numBitsSet == numBits) {
-      set.set(0, numBits);
-    } else {
-      for (int i = 0; i < numBitsSet; ++i) {
-        while (true) {
-          final int o = random().nextInt(numBits);
-          if (!set.get(o)) {
-            set.set(o);
-            break;
-          }
-        }
-      }
-    }
-    return set;
-  }
-
-  /** Same as {@link #randomSet(int, int)} but given a load factor. */
-  protected static BitSet randomSet(int numBits, float percentSet) {
-    return randomSet(numBits, (int) (percentSet * numBits));
-  }
-
   /** Test length=0. */
   public void testNoBit() throws IOException {
     final BitSet bs = new BitSet(1);

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/ExpandComponent.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/ExpandComponent.java?rev=1634012&r1=1634011&r2=1634012&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/ExpandComponent.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/ExpandComponent.java Fri Oct 24 07:32:19 2014
@@ -40,10 +40,10 @@ import org.apache.lucene.search.TopDocs;
 import org.apache.lucene.search.TopDocsCollector;
 import org.apache.lucene.search.TopFieldCollector;
 import org.apache.lucene.search.TopScoreDocCollector;
+import org.apache.lucene.util.BitSetIterator;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.CharsRefBuilder;
 import org.apache.lucene.util.FixedBitSet;
-import org.apache.lucene.util.FixedBitSet.FixedBitSetIterator;
 import org.apache.solr.common.SolrDocumentList;
 import org.apache.solr.common.params.ExpandParams;
 import org.apache.solr.common.params.ShardParams;
@@ -308,7 +308,7 @@ public class ExpandComponent extends Sea
     public GroupExpandCollector(SortedDocValues docValues, FixedBitSet groupBits, IntOpenHashSet collapsedSet, int limit, Sort sort) throws IOException {
       int numGroups = collapsedSet.size();
       groups = new IntObjectOpenHashMap<>(numGroups * 2);
-      DocIdSetIterator iterator = new FixedBitSetIterator(groupBits, 0); // cost is not useful here
+      DocIdSetIterator iterator = new BitSetIterator(groupBits, 0); // cost is not useful here
       int group;
       while ((group = iterator.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
         Collector collector = (sort == null) ? TopScoreDocCollector.create(limit, true) : TopFieldCollector.create(sort, limit, false, false, false, true);

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/response/SortingResponseWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/response/SortingResponseWriter.java?rev=1634012&r1=1634011&r2=1634012&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/response/SortingResponseWriter.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/response/SortingResponseWriter.java Fri Oct 24 07:32:19 2014
@@ -32,10 +32,10 @@ import org.apache.lucene.search.DocIdSet
 import org.apache.lucene.search.Sort;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.util.ArrayUtil;
+import org.apache.lucene.util.BitSetIterator;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.CharsRefBuilder;
 import org.apache.lucene.util.FixedBitSet;
-import org.apache.lucene.util.FixedBitSet.FixedBitSetIterator;
 import org.apache.lucene.util.LongValues;
 import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.util.NamedList;
@@ -135,7 +135,7 @@ public class SortingResponseWriter imple
       SortDoc top = queue.top();
       for(int i=0; i<leaves.size(); i++) {
         sortDoc.setNextReader(leaves.get(i));
-        DocIdSetIterator it = new FixedBitSetIterator(sets[i], 0); // cost is not useful here
+        DocIdSetIterator it = new BitSetIterator(sets[i], 0); // cost is not useful here
         int docId = -1;
         while((docId = it.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
           sortDoc.setValues(docId);

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/BitDocSet.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/BitDocSet.java?rev=1634012&r1=1634011&r2=1634012&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/BitDocSet.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/BitDocSet.java Fri Oct 24 07:32:19 2014
@@ -23,10 +23,10 @@ import org.apache.lucene.search.BitsFilt
 import org.apache.lucene.search.DocIdSet;
 import org.apache.lucene.search.DocIdSetIterator;
 import org.apache.lucene.search.Filter;
+import org.apache.lucene.util.BitDocIdSet;
+import org.apache.lucene.util.BitSetIterator;
 import org.apache.lucene.util.Bits;
 import org.apache.lucene.util.FixedBitSet;
-import org.apache.lucene.util.FixedBitSet.FixedBitSetIterator;
-import org.apache.lucene.util.FixedBitDocIdSet;
 
 /**
  * <code>BitDocSet</code> represents an unordered set of Lucene Document Ids
@@ -92,7 +92,7 @@ public class BitDocSet extends DocSetBas
   @Override
   public DocIterator iterator() {
     return new DocIterator() {
-      private final FixedBitSetIterator iter = new FixedBitSetIterator(bits, 0L); // cost is not useful here
+      private final BitSetIterator iter = new BitSetIterator(bits, 0L); // cost is not useful here
       private int pos = iter.nextDoc();
       @Override
       public boolean hasNext() {
@@ -277,7 +277,7 @@ public class BitDocSet extends DocSetBas
         final Bits acceptDocs2 = acceptDocs == null ? null : (reader.getLiveDocs() == acceptDocs ? null : acceptDocs);
 
         if (context.isTopLevel) {
-          return BitsFilteredDocIdSet.wrap(new FixedBitDocIdSet(bs), acceptDocs);
+          return BitsFilteredDocIdSet.wrap(new BitDocIdSet(bs), acceptDocs);
         }
 
         final int base = context.docBase;
@@ -302,7 +302,7 @@ public class BitDocSet extends DocSetBas
                   return adjustedDoc = NO_MORE_DOCS;
                 } else {
                   pos = bs.nextSetBit(pos + 1);
-                  return adjustedDoc = (pos >= 0 && pos < max) ? pos - base : NO_MORE_DOCS;
+                  return adjustedDoc = pos < max ? pos - base : NO_MORE_DOCS;
                 }
               }
 
@@ -314,7 +314,7 @@ public class BitDocSet extends DocSetBas
                   return adjustedDoc = NO_MORE_DOCS;
                 } else {
                   pos = bs.nextSetBit(adjusted);
-                  return adjustedDoc = (pos >= 0 && pos < max) ? pos - base : NO_MORE_DOCS;
+                  return adjustedDoc = pos < max ? pos - base : NO_MORE_DOCS;
                 }
               }
 

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/CollapsingQParserPlugin.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/CollapsingQParserPlugin.java?rev=1634012&r1=1634011&r2=1634012&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/CollapsingQParserPlugin.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/CollapsingQParserPlugin.java Fri Oct 24 07:32:19 2014
@@ -33,9 +33,9 @@ import org.apache.lucene.search.DocIdSet
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.Scorer;
+import org.apache.lucene.util.BitSetIterator;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.FixedBitSet;
-import org.apache.lucene.util.FixedBitSet.FixedBitSetIterator;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.common.params.SolrParams;
@@ -491,7 +491,7 @@ public class CollapsingQParserPlugin ext
       leafDelegate = delegate.getLeafCollector(contexts[currentContext]);
       DummyScorer dummy = new DummyScorer();
       leafDelegate.setScorer(dummy);
-      DocIdSetIterator it = new FixedBitSetIterator(collapsedSet, 0L); // cost is not useful here
+      DocIdSetIterator it = new BitSetIterator(collapsedSet, 0L); // cost is not useful here
       int docId = -1;
       int nullScoreIndex = 0;
       while((docId = it.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
@@ -604,7 +604,7 @@ public class CollapsingQParserPlugin ext
       leafDelegate = delegate.getLeafCollector(contexts[currentContext]);
       DummyScorer dummy = new DummyScorer();
       leafDelegate.setScorer(dummy);
-      DocIdSetIterator it = new FixedBitSetIterator(fieldValueCollapse.getCollapsedSet(), 0); // cost is not useful here
+      DocIdSetIterator it = new BitSetIterator(fieldValueCollapse.getCollapsedSet(), 0); // cost is not useful here
       int docId = -1;
       int nullScoreIndex = 0;
       float[] scores = fieldValueCollapse.getScores();

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/DocSetBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/DocSetBase.java?rev=1634012&r1=1634011&r2=1634012&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/DocSetBase.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/DocSetBase.java Fri Oct 24 07:32:19 2014
@@ -24,7 +24,7 @@ import org.apache.lucene.search.DocIdSet
 import org.apache.lucene.search.DocIdSetIterator;
 import org.apache.lucene.search.Filter;
 import org.apache.lucene.util.Bits;
-import org.apache.lucene.util.FixedBitDocIdSet;
+import org.apache.lucene.util.BitDocIdSet;
 import org.apache.lucene.util.FixedBitSet;
 import org.apache.solr.common.SolrException;
 
@@ -172,7 +172,7 @@ abstract class DocSetBase implements Doc
         final Bits acceptDocs2 = acceptDocs == null ? null : (reader.getLiveDocs() == acceptDocs ? null : acceptDocs);
 
         if (context.isTopLevel) {
-          return BitsFilteredDocIdSet.wrap(new FixedBitDocIdSet(bs), acceptDocs);
+          return BitsFilteredDocIdSet.wrap(new BitDocIdSet(bs), acceptDocs);
         }
 
         final int base = context.docBase;
@@ -194,14 +194,14 @@ abstract class DocSetBase implements Doc
               @Override
               public int nextDoc() {
                 pos = bs.nextSetBit(pos+1);
-                return adjustedDoc = (pos>=0 && pos<max) ? pos-base : NO_MORE_DOCS;
+                return adjustedDoc = pos<max ? pos-base : NO_MORE_DOCS;
               }
 
               @Override
               public int advance(int target) {
                 if (target==NO_MORE_DOCS) return adjustedDoc=NO_MORE_DOCS;
                 pos = bs.nextSetBit(target+base);
-                return adjustedDoc = (pos>=0 && pos<max) ? pos-base : NO_MORE_DOCS;
+                return adjustedDoc = pos<max ? pos-base : NO_MORE_DOCS;
               }
 
               @Override

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/join/BitSetSlice.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/join/BitSetSlice.java?rev=1634012&r1=1634011&r2=1634012&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/join/BitSetSlice.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/join/BitSetSlice.java Fri Oct 24 07:32:19 2014
@@ -41,6 +41,6 @@ class BitSetSlice {
 
   public int nextSetBit(int pos) {
     int result = fbs.nextSetBit(pos + off) - off;
-    return (result < 0 || result >= len) ? -1 : result;
+    return (result >= len) ? -1 : result;
   }
 }

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/TestDocSet.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/TestDocSet.java?rev=1634012&r1=1634011&r2=1634012&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/TestDocSet.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/TestDocSet.java Fri Oct 24 07:32:19 2014
@@ -39,9 +39,9 @@ import org.apache.lucene.index.StoredFie
 import org.apache.lucene.search.DocIdSet;
 import org.apache.lucene.search.DocIdSetIterator;
 import org.apache.lucene.search.Filter;
+import org.apache.lucene.util.BitSetIterator;
 import org.apache.lucene.util.Bits;
 import org.apache.lucene.util.FixedBitSet;
-import org.apache.lucene.util.FixedBitSet.FixedBitSetIterator;
 import org.apache.lucene.util.LuceneTestCase;
 
 /**
@@ -68,7 +68,7 @@ public class TestDocSet extends LuceneTe
 
   public DocSet getHashDocSet(FixedBitSet bs) {
     int[] docs = new int[bs.cardinality()];
-    FixedBitSetIterator iter = new FixedBitSetIterator(bs, 0);
+    BitSetIterator iter = new BitSetIterator(bs, 0);
     for (int i=0; i<docs.length; i++) {
       docs[i] = iter.nextDoc();
     }
@@ -77,7 +77,7 @@ public class TestDocSet extends LuceneTe
 
   public DocSet getIntDocSet(FixedBitSet bs) {
     int[] docs = new int[bs.cardinality()];
-    FixedBitSetIterator iter = new FixedBitSetIterator(bs, 0);
+    BitSetIterator iter = new BitSetIterator(bs, 0);
     for (int i=0; i<docs.length; i++) {
       docs[i] = iter.nextDoc();
     }
@@ -95,7 +95,7 @@ public class TestDocSet extends LuceneTe
     int offset = 3;
     int end = offset + len;
 
-    FixedBitSetIterator iter = new FixedBitSetIterator(bs, 0);
+    BitSetIterator iter = new BitSetIterator(bs, 0);
     // put in opposite order... DocLists are not ordered.
     for (int i=end-1; i>=offset; i--) {
       arr[i] = iter.nextDoc();

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/TestFiltering.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/TestFiltering.java?rev=1634012&r1=1634011&r2=1634012&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/TestFiltering.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/TestFiltering.java Fri Oct 24 07:32:19 2014
@@ -18,6 +18,7 @@
 package org.apache.solr.search;
 
 
+import org.apache.lucene.search.DocIdSetIterator;
 import org.apache.lucene.util.FixedBitSet;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.params.SolrParams;
@@ -222,7 +223,7 @@ public class TestFiltering extends SolrT
       for (int doc=-1;;) {
         if (doc+1 >= model.indexSize) break;
         doc = pset.nextSetBit(doc+1);
-        if (doc < 0) break;
+        if (doc == DocIdSetIterator.NO_MORE_DOCS) break;
         sb.append((positive ? " ":" -") + f+":"+doc);
       }
 

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/TestSort.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/TestSort.java?rev=1634012&r1=1634011&r2=1634012&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/TestSort.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/TestSort.java Fri Oct 24 07:32:19 2014
@@ -53,7 +53,7 @@ import org.apache.lucene.store.Directory
 import org.apache.lucene.store.RAMDirectory;
 import org.apache.lucene.uninverting.UninvertingReader;
 import org.apache.lucene.util.Bits;
-import org.apache.lucene.util.FixedBitDocIdSet;
+import org.apache.lucene.util.BitDocIdSet;
 import org.apache.lucene.util.FixedBitSet;
 import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrTestCaseJ4;
@@ -340,7 +340,7 @@ public class TestSort extends SolrTestCa
     for (int i=0; i<n; i++) {
       obs.set(r.nextInt(sz));
     }
-    return new FixedBitDocIdSet(obs);
+    return new BitDocIdSet(obs);
   }  
   
 

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/util/BitSetPerf.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/util/BitSetPerf.java?rev=1634012&r1=1634011&r2=1634012&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/util/BitSetPerf.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/util/BitSetPerf.java Fri Oct 24 07:32:19 2014
@@ -20,8 +20,9 @@ package org.apache.solr.util;
 import java.util.BitSet;
 import java.util.Random;
 
+import org.apache.lucene.search.DocIdSetIterator;
+import org.apache.lucene.util.BitSetIterator;
 import org.apache.lucene.util.FixedBitSet;
-import org.apache.lucene.util.FixedBitSet.FixedBitSetIterator;
 
 /** Performance tester for FixedBitSet.
  * Use -Xbatch for more predictable results, and run tests such that the duration
@@ -153,7 +154,7 @@ public class BitSetPerf {
         for (int i=0; i<numSets; i++) {
           if (impl=="open") {
             final FixedBitSet set = osets[i];
-            for(int next=set.nextSetBit(0); next>=0; next=set.nextSetBit(next+1)) {
+            for(int next=set.nextSetBit(0); next != DocIdSetIterator.NO_MORE_DOCS; next=set.nextSetBit(next+1)) {
               ret += next;
             }
           } else {
@@ -172,7 +173,7 @@ public class BitSetPerf {
         for (int i=0; i<numSets; i++) {
           if (impl=="open") {
             final FixedBitSet set = osets[i];
-            final FixedBitSetIterator iterator = new FixedBitSetIterator(set, 0);
+            final BitSetIterator iterator = new BitSetIterator(set, 0);
             for(int next=iterator.nextDoc(); next>=0; next=iterator.nextDoc()) {
               ret += next;
             }



Mime
View raw message