lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpou...@apache.org
Subject svn commit: r1634013 [2/2] - in /lucene/dev/branches/branch_5x: ./ lucene/ lucene/codecs/ lucene/codecs/src/java/org/apache/lucene/codecs/bloom/ lucene/core/ lucene/core/src/java/org/apache/lucene/search/ lucene/core/src/java/org/apache/lucene/util/ lu...
Date Fri, 24 Oct 2014 07:39:17 GMT
Modified: lucene/dev/branches/branch_5x/lucene/misc/src/java/org/apache/lucene/index/sorter/BlockJoinComparatorSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/misc/src/java/org/apache/lucene/index/sorter/BlockJoinComparatorSource.java?rev=1634013&r1=1634012&r2=1634013&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/misc/src/java/org/apache/lucene/index/sorter/BlockJoinComparatorSource.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/misc/src/java/org/apache/lucene/index/sorter/BlockJoinComparatorSource.java
Fri Oct 24 07:39:15 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/branches/branch_5x/lucene/misc/src/test/org/apache/lucene/index/sorter/TestBlockJoinSorter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/misc/src/test/org/apache/lucene/index/sorter/TestBlockJoinSorter.java?rev=1634013&r1=1634012&r2=1634013&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/misc/src/test/org/apache/lucene/index/sorter/TestBlockJoinSorter.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/misc/src/test/org/apache/lucene/index/sorter/TestBlockJoinSorter.java
Fri Oct 24 07:39:15 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/branches/branch_5x/lucene/misc/src/test/org/apache/lucene/uninverting/TestFieldCacheSortRandom.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/misc/src/test/org/apache/lucene/uninverting/TestFieldCacheSortRandom.java?rev=1634013&r1=1634012&r2=1634013&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/misc/src/test/org/apache/lucene/uninverting/TestFieldCacheSortRandom.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/misc/src/test/org/apache/lucene/uninverting/TestFieldCacheSortRandom.java
Fri Oct 24 07:39:15 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/branches/branch_5x/lucene/queries/src/java/org/apache/lucene/queries/BooleanFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/queries/src/java/org/apache/lucene/queries/BooleanFilter.java?rev=1634013&r1=1634012&r2=1634013&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/queries/src/java/org/apache/lucene/queries/BooleanFilter.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/queries/src/java/org/apache/lucene/queries/BooleanFilter.java
Fri Oct 24 07:39:15 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/branches/branch_5x/lucene/queries/src/test/org/apache/lucene/queries/BooleanFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/queries/src/test/org/apache/lucene/queries/BooleanFilterTest.java?rev=1634013&r1=1634012&r2=1634013&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/queries/src/test/org/apache/lucene/queries/BooleanFilterTest.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/queries/src/test/org/apache/lucene/queries/BooleanFilterTest.java
Fri Oct 24 07:39:15 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/branches/branch_5x/lucene/queries/src/test/org/apache/lucene/queries/TermsFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/queries/src/test/org/apache/lucene/queries/TermsFilterTest.java?rev=1634013&r1=1634012&r2=1634013&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/queries/src/test/org/apache/lucene/queries/TermsFilterTest.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/queries/src/test/org/apache/lucene/queries/TermsFilterTest.java
Fri Oct 24 07:39:15 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/branches/branch_5x/lucene/sandbox/src/java/org/apache/lucene/sandbox/queries/DuplicateFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/sandbox/src/java/org/apache/lucene/sandbox/queries/DuplicateFilter.java?rev=1634013&r1=1634012&r2=1634013&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/sandbox/src/java/org/apache/lucene/sandbox/queries/DuplicateFilter.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/sandbox/src/java/org/apache/lucene/sandbox/queries/DuplicateFilter.java
Fri Oct 24 07:39:15 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/branches/branch_5x/lucene/sandbox/src/test/org/apache/lucene/search/TestTermAutomatonQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/sandbox/src/test/org/apache/lucene/search/TestTermAutomatonQuery.java?rev=1634013&r1=1634012&r2=1634013&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/sandbox/src/test/org/apache/lucene/search/TestTermAutomatonQuery.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/sandbox/src/test/org/apache/lucene/search/TestTermAutomatonQuery.java
Fri Oct 24 07:39:15 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/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/IntersectsPrefixTreeFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/IntersectsPrefixTreeFilter.java?rev=1634013&r1=1634012&r2=1634013&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/IntersectsPrefixTreeFilter.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/IntersectsPrefixTreeFilter.java
Fri Oct 24 07:39:15 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/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/WithinPrefixTreeFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/WithinPrefixTreeFilter.java?rev=1634013&r1=1634012&r2=1634013&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/WithinPrefixTreeFilter.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/WithinPrefixTreeFilter.java
Fri Oct 24 07:39:15 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

Modified: lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/util/BaseDocIdSetTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/util/BaseDocIdSetTestCase.java?rev=1634013&r1=1634012&r2=1634013&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/util/BaseDocIdSetTestCase.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/util/BaseDocIdSetTestCase.java
Fri Oct 24 07:39:15 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/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/component/ExpandComponent.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/component/ExpandComponent.java?rev=1634013&r1=1634012&r2=1634013&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/component/ExpandComponent.java
(original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/component/ExpandComponent.java
Fri Oct 24 07:39:15 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/branches/branch_5x/solr/core/src/java/org/apache/solr/response/SortingResponseWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/response/SortingResponseWriter.java?rev=1634013&r1=1634012&r2=1634013&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/response/SortingResponseWriter.java
(original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/response/SortingResponseWriter.java
Fri Oct 24 07:39:15 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/branches/branch_5x/solr/core/src/java/org/apache/solr/search/BitDocSet.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/search/BitDocSet.java?rev=1634013&r1=1634012&r2=1634013&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/search/BitDocSet.java
(original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/search/BitDocSet.java
Fri Oct 24 07:39:15 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/branches/branch_5x/solr/core/src/java/org/apache/solr/search/CollapsingQParserPlugin.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/search/CollapsingQParserPlugin.java?rev=1634013&r1=1634012&r2=1634013&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/search/CollapsingQParserPlugin.java
(original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/search/CollapsingQParserPlugin.java
Fri Oct 24 07:39:15 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/branches/branch_5x/solr/core/src/java/org/apache/solr/search/DocSetBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/search/DocSetBase.java?rev=1634013&r1=1634012&r2=1634013&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/search/DocSetBase.java
(original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/search/DocSetBase.java
Fri Oct 24 07:39:15 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/branches/branch_5x/solr/core/src/java/org/apache/solr/search/join/BitSetSlice.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/search/join/BitSetSlice.java?rev=1634013&r1=1634012&r2=1634013&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/search/join/BitSetSlice.java
(original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/search/join/BitSetSlice.java
Fri Oct 24 07:39:15 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/branches/branch_5x/solr/core/src/test/org/apache/solr/search/TestDocSet.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/search/TestDocSet.java?rev=1634013&r1=1634012&r2=1634013&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/search/TestDocSet.java
(original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/search/TestDocSet.java
Fri Oct 24 07:39:15 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/branches/branch_5x/solr/core/src/test/org/apache/solr/search/TestFiltering.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/search/TestFiltering.java?rev=1634013&r1=1634012&r2=1634013&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/search/TestFiltering.java
(original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/search/TestFiltering.java
Fri Oct 24 07:39:15 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/branches/branch_5x/solr/core/src/test/org/apache/solr/search/TestSort.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/search/TestSort.java?rev=1634013&r1=1634012&r2=1634013&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/search/TestSort.java
(original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/search/TestSort.java
Fri Oct 24 07:39:15 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/branches/branch_5x/solr/core/src/test/org/apache/solr/util/BitSetPerf.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/util/BitSetPerf.java?rev=1634013&r1=1634012&r2=1634013&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/util/BitSetPerf.java
(original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/util/BitSetPerf.java
Fri Oct 24 07:39:15 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