lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpou...@apache.org
Subject svn commit: r1687581 [7/9] - in /lucene/dev/branches/branch_5x: ./ lucene/ lucene/analysis/common/src/test/org/apache/lucene/analysis/core/ lucene/analysis/common/src/test/org/apache/lucene/analysis/sinks/ lucene/analysis/common/src/test/org/apache/luc...
Date Thu, 25 Jun 2015 17:07:14 GMT
Modified: lucene/dev/branches/branch_5x/lucene/sandbox/src/test/org/apache/lucene/codecs/idversion/TestIDVersionPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/sandbox/src/test/org/apache/lucene/codecs/idversion/TestIDVersionPostingsFormat.java?rev=1687581&r1=1687580&r2=1687581&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/sandbox/src/test/org/apache/lucene/codecs/idversion/TestIDVersionPostingsFormat.java (original)
+++ lucene/dev/branches/branch_5x/lucene/sandbox/src/test/org/apache/lucene/codecs/idversion/TestIDVersionPostingsFormat.java Thu Jun 25 17:07:11 2015
@@ -330,9 +330,9 @@ public class TestIDVersionPostingsFormat
           if (VERBOSE) {
             System.out.println("  found in seg=" + termsEnums[seg]);
           }
-          postingsEnums[seg] = termsEnums[seg].postings(liveDocs[seg], postingsEnums[seg], 0);
+          postingsEnums[seg] = termsEnums[seg].postings(postingsEnums[seg], 0);
           int docID = postingsEnums[seg].nextDoc();
-          if (docID != PostingsEnum.NO_MORE_DOCS) {
+          if (docID != PostingsEnum.NO_MORE_DOCS && (liveDocs[seg] == null || liveDocs[seg].get(docID))) {
             lastVersion = ((IDVersionSegmentTermsEnum) termsEnums[seg]).getVersion();
             return docBases[seg] + docID;
           }

Modified: lucene/dev/branches/branch_5x/lucene/sandbox/src/test/org/apache/lucene/sandbox/queries/DuplicateFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/sandbox/src/test/org/apache/lucene/sandbox/queries/DuplicateFilterTest.java?rev=1687581&r1=1687580&r2=1687581&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/sandbox/src/test/org/apache/lucene/sandbox/queries/DuplicateFilterTest.java (original)
+++ lucene/dev/branches/branch_5x/lucene/sandbox/src/test/org/apache/lucene/sandbox/queries/DuplicateFilterTest.java Thu Jun 25 17:07:11 2015
@@ -141,7 +141,6 @@ public class DuplicateFilterTest extends
       PostingsEnum td = TestUtil.docs(random(), reader,
           KEY_FIELD,
           new BytesRef(url),
-          MultiFields.getLiveDocs(reader),
           null,
           0);
 
@@ -165,7 +164,6 @@ public class DuplicateFilterTest extends
       PostingsEnum td = TestUtil.docs(random(), reader,
           KEY_FIELD,
           new BytesRef(url),
-          MultiFields.getLiveDocs(reader),
           null,
           0);
 

Modified: lucene/dev/branches/branch_5x/lucene/sandbox/src/test/org/apache/lucene/search/TestDocValuesRangeQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/sandbox/src/test/org/apache/lucene/search/TestDocValuesRangeQuery.java?rev=1687581&r1=1687580&r2=1687581&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/sandbox/src/test/org/apache/lucene/search/TestDocValuesRangeQuery.java (original)
+++ lucene/dev/branches/branch_5x/lucene/sandbox/src/test/org/apache/lucene/search/TestDocValuesRangeQuery.java Thu Jun 25 17:07:11 2015
@@ -268,12 +268,12 @@ public class TestDocValuesRangeQuery ext
 
     Query q1 = DocValuesRangeQuery.newLongRange("dv1", 0L, 100L, random().nextBoolean(), random().nextBoolean());
     Weight w = searcher.createNormalizedWeight(q1, true);
-    Scorer s = w.scorer(ctx, null);
+    Scorer s = w.scorer(ctx);
     assertNotNull(s.asTwoPhaseIterator());
 
     Query q2 = DocValuesRangeQuery.newBytesRefRange("dv2", toSortableBytes(0L), toSortableBytes(100L), random().nextBoolean(), random().nextBoolean());
     w = searcher.createNormalizedWeight(q2, true);
-    s = w.scorer(ctx, null);
+    s = w.scorer(ctx);
     assertNotNull(s.asTwoPhaseIterator());
 
     reader.close();

Modified: lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/composite/CompositeVerifyQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/composite/CompositeVerifyQuery.java?rev=1687581&r1=1687580&r2=1687581&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/composite/CompositeVerifyQuery.java (original)
+++ lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/composite/CompositeVerifyQuery.java Thu Jun 25 17:07:11 2015
@@ -94,9 +94,9 @@ public class CompositeVerifyQuery extend
     return new ConstantScoreWeight(this) {
 
       @Override
-      public Scorer scorer(LeafReaderContext context, Bits acceptDocs) throws IOException {
+      public Scorer scorer(LeafReaderContext context) throws IOException {
 
-        final Scorer indexQueryScorer = indexQueryWeight.scorer(context, acceptDocs);//pass acceptDocs through
+        final Scorer indexQueryScorer = indexQueryWeight.scorer(context);
         if (indexQueryScorer == null) {
           return null;
         }

Modified: lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/composite/IntersectsRPTVerifyQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/composite/IntersectsRPTVerifyQuery.java?rev=1687581&r1=1687580&r2=1687581&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/composite/IntersectsRPTVerifyQuery.java (original)
+++ lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/composite/IntersectsRPTVerifyQuery.java Thu Jun 25 17:07:11 2015
@@ -90,10 +90,10 @@ public class IntersectsRPTVerifyQuery ex
 
     return new ConstantScoreWeight(this) {
       @Override
-      public Scorer scorer(LeafReaderContext context, Bits acceptDocs) throws IOException {
+      public Scorer scorer(LeafReaderContext context) throws IOException {
         // Compute approx & exact
         final IntersectsDifferentiatingFilter.IntersectsDifferentiatingVisitor result =
-            intersectsDiffFilter.compute(context, acceptDocs);
+            intersectsDiffFilter.compute(context, null);
         if (result.approxDocIdSet == null) {
           return null;
         }

Modified: lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/AbstractPrefixTreeFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/AbstractPrefixTreeFilter.java?rev=1687581&r1=1687580&r2=1687581&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/AbstractPrefixTreeFilter.java (original)
+++ lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/AbstractPrefixTreeFilter.java Thu Jun 25 17:07:11 2015
@@ -20,11 +20,14 @@ package org.apache.lucene.spatial.prefix
 import java.io.IOException;
 
 import com.spatial4j.core.shape.Shape;
+
+import org.apache.lucene.index.FilterLeafReader.FilterPostingsEnum;
 import org.apache.lucene.index.LeafReader;
 import org.apache.lucene.index.LeafReaderContext;
 import org.apache.lucene.index.PostingsEnum;
 import org.apache.lucene.index.Terms;
 import org.apache.lucene.index.TermsEnum;
+import org.apache.lucene.search.DocIdSetIterator;
 import org.apache.lucene.search.Filter;
 import org.apache.lucene.spatial.prefix.tree.SpatialPrefixTree;
 import org.apache.lucene.util.BitDocIdSet;
@@ -96,15 +99,51 @@ public abstract class AbstractPrefixTree
 
     protected void collectDocs(BitSet bitSet) throws IOException {
       assert termsEnum != null;
-      postingsEnum = termsEnum.postings(acceptDocs, postingsEnum, PostingsEnum.NONE);
-      bitSet.or(postingsEnum);
+      postingsEnum = termsEnum.postings(postingsEnum, PostingsEnum.NONE);
+      bitSet.or(wrap(postingsEnum, acceptDocs));
     }
 
     protected void collectDocs(BitDocIdSet.Builder bitSetBuilder) throws IOException {
       assert termsEnum != null;
-      postingsEnum = termsEnum.postings(acceptDocs, postingsEnum, PostingsEnum.NONE);
-      bitSetBuilder.or(postingsEnum);
+      postingsEnum = termsEnum.postings(postingsEnum, PostingsEnum.NONE);
+      bitSetBuilder.or(wrap(postingsEnum, acceptDocs));
+    }
+  }
+
+  /** Filter the given {@link PostingsEnum} with the given {@link Bits}. */
+  private static PostingsEnum wrap(PostingsEnum iterator, Bits acceptDocs) {
+    if (iterator == null || acceptDocs == null) {
+      return iterator;
     }
+    return new BitsFilteredPostingsEnum(iterator, acceptDocs);
   }
 
+  /** A {@link PostingsEnum} which is filtered by some random-access bits. */
+  private static class BitsFilteredPostingsEnum extends FilterPostingsEnum {
+
+    private final Bits bits;
+
+    private BitsFilteredPostingsEnum(PostingsEnum in, Bits bits) {
+      super(in);
+      this.bits = bits;
+    }
+
+    private int doNext(int doc) throws IOException {
+      while (doc != NO_MORE_DOCS && bits.get(doc) == false) {
+        doc = in.nextDoc();
+      }
+      return doc;
+    }
+
+    @Override
+    public int nextDoc() throws IOException {
+      return doNext(in.nextDoc());
+    }
+
+    @Override
+    public int advance(int target) throws IOException {
+      return doNext(in.advance(target));
+    }
+
+  }
 }

Modified: lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/ContainsPrefixTreeFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/ContainsPrefixTreeFilter.java?rev=1687581&r1=1687580&r2=1687581&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/ContainsPrefixTreeFilter.java (original)
+++ lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/ContainsPrefixTreeFilter.java Thu Jun 25 17:07:11 2015
@@ -218,9 +218,12 @@ public class ContainsPrefixTreeFilter ex
     private SmallDocSet collectDocs(Bits acceptContains) throws IOException {
       SmallDocSet set = null;
 
-      postingsEnum = termsEnum.postings(acceptContains, postingsEnum, PostingsEnum.NONE);
+      postingsEnum = termsEnum.postings(postingsEnum, PostingsEnum.NONE);
       int docid;
       while ((docid = postingsEnum.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
+        if (acceptContains != null && acceptContains.get(docid) == false) {
+          continue;
+        }
         if (set == null) {
           int size = termsEnum.docFreq();
           if (size <= 0)

Modified: lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/PrefixTreeFacetCounter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/PrefixTreeFacetCounter.java?rev=1687581&r1=1687580&r2=1687581&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/PrefixTreeFacetCounter.java (original)
+++ lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/PrefixTreeFacetCounter.java Thu Jun 25 17:07:11 2015
@@ -183,8 +183,11 @@ public class PrefixTreeFacetCounter {
               return termsEnum.docFreq();
             }
             int count = 0;
-            postingsEnum = termsEnum.postings(acceptDocs, postingsEnum, PostingsEnum.NONE);
+            postingsEnum = termsEnum.postings(postingsEnum, PostingsEnum.NONE);
             while (postingsEnum.nextDoc() != DocIdSetIterator.NO_MORE_DOCS) {
+              if (acceptDocs != null && acceptDocs.get(postingsEnum.docID()) == false) {
+                continue;
+              }
               count++;
             }
             return count;
@@ -194,8 +197,12 @@ public class PrefixTreeFacetCounter {
             if (acceptDocs == null) {
               return true;
             }
-            postingsEnum = termsEnum.postings(acceptDocs, postingsEnum, PostingsEnum.NONE);
-            return (postingsEnum.nextDoc() != DocIdSetIterator.NO_MORE_DOCS);
+            postingsEnum = termsEnum.postings(postingsEnum, PostingsEnum.NONE);
+            int nextDoc = postingsEnum.nextDoc();
+            while (nextDoc != DocIdSetIterator.NO_MORE_DOCS && acceptDocs.get(nextDoc) == false) {
+              nextDoc = postingsEnum.nextDoc();
+            }
+            return nextDoc != DocIdSetIterator.NO_MORE_DOCS;
           }
 
         }.getDocIdSet();

Modified: lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/util/ShapeFieldCacheProvider.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/util/ShapeFieldCacheProvider.java?rev=1687581&r1=1687580&r2=1687581&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/util/ShapeFieldCacheProvider.java (original)
+++ lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/util/ShapeFieldCacheProvider.java Thu Jun 25 17:07:11 2015
@@ -69,7 +69,7 @@ public abstract class ShapeFieldCachePro
       while (term != null) {
         T shape = readShape(term);
         if( shape != null ) {
-          docs = te.postings(null, docs, PostingsEnum.NONE);
+          docs = te.postings(docs, PostingsEnum.NONE);
           Integer docid = docs.nextDoc();
           while (docid != DocIdSetIterator.NO_MORE_DOCS) {
             idx.add( docid, shape );

Modified: lucene/dev/branches/branch_5x/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/BlendedInfixSuggester.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/BlendedInfixSuggester.java?rev=1687581&r1=1687580&r2=1687581&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/BlendedInfixSuggester.java (original)
+++ lucene/dev/branches/branch_5x/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/BlendedInfixSuggester.java Thu Jun 25 17:07:11 2015
@@ -288,7 +288,7 @@ public class BlendedInfixSuggester exten
 
       if (matchedTokens.contains(docTerm) || (prefixToken != null && docTerm.startsWith(prefixToken))) {
  
-        PostingsEnum docPosEnum = it.postings(null, null, PostingsEnum.OFFSETS);
+        PostingsEnum docPosEnum = it.postings(null, PostingsEnum.OFFSETS);
         docPosEnum.nextDoc();
 
         // use the first occurrence of the term

Modified: lucene/dev/branches/branch_5x/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/CompletionFieldsConsumer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/CompletionFieldsConsumer.java?rev=1687581&r1=1687580&r2=1687581&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/CompletionFieldsConsumer.java (original)
+++ lucene/dev/branches/branch_5x/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/CompletionFieldsConsumer.java Thu Jun 25 17:07:11 2015
@@ -196,7 +196,7 @@ final class CompletionFieldsConsumer ext
      * Writes all postings (surface form, weight, document id) for <code>term</code>
      */
     public void write(BytesRef term, TermsEnum termsEnum) throws IOException {
-      postingsEnum = termsEnum.postings(null, postingsEnum, PostingsEnum.PAYLOADS);
+      postingsEnum = termsEnum.postings(postingsEnum, PostingsEnum.PAYLOADS);
       builder.startTerm(term);
       int docFreq = 0;
       while (postingsEnum.nextDoc() != DocIdSetIterator.NO_MORE_DOCS) {

Modified: lucene/dev/branches/branch_5x/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/CompletionScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/CompletionScorer.java?rev=1687581&r1=1687580&r2=1687581&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/CompletionScorer.java (original)
+++ lucene/dev/branches/branch_5x/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/CompletionScorer.java Thu Jun 25 17:07:11 2015
@@ -30,17 +30,17 @@ import org.apache.lucene.util.automaton.
  * appropriate suggester and collecting the results
  * via a collector.
  *
- * {@link #score(LeafCollector, int, int)} is called
+ * {@link #score(LeafCollector, Bits, int, int)} is called
  * for each leaf reader.
  *
- * {@link #accept(int)} and {@link #score(float, float)}
+ * {@link #accept(int,Bits)} and {@link #score(float, float)}
  * is called for every matched completion (i.e. document)
  *
  * @lucene.experimental
  */
 public class CompletionScorer extends BulkScorer {
   private final NRTSuggester suggester;
-  private final Bits acceptDocs;
+  private final Bits filterDocs;
 
   // values accessed by suggester
   /** weight that created this scorer */
@@ -53,22 +53,22 @@ public class CompletionScorer extends Bu
    * Creates a scorer for a field-specific <code>suggester</code> scoped by <code>acceptDocs</code>
    */
   protected CompletionScorer(final CompletionWeight weight, final NRTSuggester suggester,
-                             final LeafReader reader, final Bits acceptDocs,
+                             final LeafReader reader, final Bits filterDocs,
                              final boolean filtered, final Automaton automaton) throws IOException {
     this.weight = weight;
     this.suggester = suggester;
     this.reader = reader;
     this.automaton = automaton;
     this.filtered = filtered;
-    this.acceptDocs = acceptDocs;
+    this.filterDocs = filterDocs;
   }
 
   @Override
-  public int score(LeafCollector collector, int min, int max) throws IOException {
+  public int score(LeafCollector collector, Bits acceptDocs, int min, int max) throws IOException {
     if (!(collector instanceof TopSuggestDocsCollector)) {
       throw new IllegalArgumentException("collector is not of type TopSuggestDocsCollector");
     }
-    suggester.lookup(this, ((TopSuggestDocsCollector) collector));
+    suggester.lookup(this, acceptDocs, ((TopSuggestDocsCollector) collector));
     return max;
   }
 
@@ -81,9 +81,12 @@ public class CompletionScorer extends Bu
    * Returns true if a document with <code>docID</code> is accepted,
    * false if the docID maps to a deleted
    * document or has been filtered out
+   * @param liveDocs the {@link Bits} representing live docs, or possibly
+   *                 {@code null} if all docs are live
    */
-  public final boolean accept(int docID) {
-    return acceptDocs == null || acceptDocs.get(docID);
+  public final boolean accept(int docID, Bits liveDocs) {
+    return (filterDocs == null || filterDocs.get(docID))
+        && (liveDocs == null || liveDocs.get(docID));
   }
 
   /**

Modified: lucene/dev/branches/branch_5x/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/CompletionWeight.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/CompletionWeight.java?rev=1687581&r1=1687580&r2=1687581&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/CompletionWeight.java (original)
+++ lucene/dev/branches/branch_5x/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/CompletionWeight.java Thu Jun 25 17:07:11 2015
@@ -70,7 +70,7 @@ public class CompletionWeight extends We
   }
 
   @Override
-  public BulkScorer bulkScorer(final LeafReaderContext context, Bits acceptDocs) throws IOException {
+  public BulkScorer bulkScorer(final LeafReaderContext context) throws IOException {
     final LeafReader reader = context.reader();
     final Terms terms;
     final NRTSuggester suggester;
@@ -91,7 +91,7 @@ public class CompletionWeight extends We
     DocIdSet docIdSet = null;
     Filter filter = completionQuery.getFilter();
     if (filter != null) {
-      docIdSet = filter.getDocIdSet(context, acceptDocs);
+      docIdSet = filter.getDocIdSet(context, null);
       if (docIdSet == null || docIdSet.iterator() == null) {
         // filter matches no docs in current leave
         return null;
@@ -99,7 +99,7 @@ public class CompletionWeight extends We
         throw new IllegalArgumentException("DocIDSet does not provide random access interface");
       }
     }
-    Bits acceptDocBits = (docIdSet != null) ? docIdSet.bits() : acceptDocs;
+    Bits acceptDocBits = (docIdSet != null) ? docIdSet.bits() : null;
     return new CompletionScorer(this, suggester, reader, acceptDocBits, filter != null, automaton);
   }
 
@@ -134,7 +134,7 @@ public class CompletionWeight extends We
   }
 
   @Override
-  public Scorer scorer(LeafReaderContext context, Bits acceptDocs) throws IOException {
+  public Scorer scorer(LeafReaderContext context) throws IOException {
     throw new UnsupportedOperationException();
   }
 

Modified: lucene/dev/branches/branch_5x/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/NRTSuggester.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/NRTSuggester.java?rev=1687581&r1=1687580&r2=1687581&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/NRTSuggester.java (original)
+++ lucene/dev/branches/branch_5x/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/NRTSuggester.java Thu Jun 25 17:07:11 2015
@@ -28,6 +28,7 @@ import org.apache.lucene.store.ByteArray
 import org.apache.lucene.store.ByteArrayDataOutput;
 import org.apache.lucene.store.IndexInput;
 import org.apache.lucene.util.Accountable;
+import org.apache.lucene.util.Bits;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.CharsRefBuilder;
 import org.apache.lucene.util.fst.ByteSequenceOutputs;
@@ -44,7 +45,7 @@ import static org.apache.lucene.search.s
  * <p>
  * NRTSuggester executes Top N search on a weighted FST specified by a {@link CompletionScorer}
  * <p>
- * See {@link #lookup(CompletionScorer, TopSuggestDocsCollector)} for more implementation
+ * See {@link #lookup(CompletionScorer, Bits, TopSuggestDocsCollector)} for more implementation
  * details.
  * <p>
  * FST Format:
@@ -56,7 +57,7 @@ import static org.apache.lucene.search.s
  * NOTE:
  * <ul>
  *   <li>having too many deletions or using a very restrictive filter can make the search inadmissible due to
- *     over-pruning of potential paths. See {@link CompletionScorer#accept(int)}</li>
+ *     over-pruning of potential paths. See {@link CompletionScorer#accept(int, Bits)}</li>
  *   <li>when matched documents are arbitrarily filtered ({@link CompletionScorer#filtered} set to <code>true</code>,
  *     it is assumed that the filter will roughly filter out half the number of documents that match
  *     the provided automaton</li>
@@ -120,12 +121,12 @@ public final class NRTSuggester implemen
    * The {@link CompletionScorer#automaton} is intersected with the {@link #fst}.
    * {@link CompletionScorer#weight} is used to compute boosts and/or extract context
    * for each matched partial paths. A top N search is executed on {@link #fst} seeded with
-   * the matched partial paths. Upon reaching a completed path, {@link CompletionScorer#accept(int)}
+   * the matched partial paths. Upon reaching a completed path, {@link CompletionScorer#accept(int, Bits)}
    * and {@link CompletionScorer#score(float, float)} is used on the document id, index weight
    * and query boost to filter and score the entry, before being collected via
    * {@link TopSuggestDocsCollector#collect(int, CharSequence, CharSequence, float)}
    */
-  public void lookup(final CompletionScorer scorer, final TopSuggestDocsCollector collector) throws IOException {
+  public void lookup(final CompletionScorer scorer, final Bits acceptDocs, final TopSuggestDocsCollector collector) throws IOException {
     final double liveDocsRatio = calculateLiveDocRatio(scorer.reader.numDocs(), scorer.reader.maxDoc());
     if (liveDocsRatio == -1) {
       return;
@@ -143,7 +144,7 @@ public final class NRTSuggester implemen
       protected boolean acceptResult(Util.FSTPath<Pair<Long, BytesRef>> path) {
         int payloadSepIndex = parseSurfaceForm(path.cost.output2, payloadSep, spare);
         int docID = parseDocID(path.cost.output2, payloadSepIndex);
-        if (!scorer.accept(docID)) {
+        if (!scorer.accept(docID, acceptDocs)) {
           return false;
         }
         try {

Modified: lucene/dev/branches/branch_5x/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/SuggestIndexSearcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/SuggestIndexSearcher.java?rev=1687581&r1=1687580&r2=1687581&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/SuggestIndexSearcher.java (original)
+++ lucene/dev/branches/branch_5x/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/SuggestIndexSearcher.java Thu Jun 25 17:07:11 2015
@@ -70,10 +70,10 @@ public class SuggestIndexSearcher extend
     query = (CompletionQuery) query.rewrite(getIndexReader());
     Weight weight = query.createWeight(this, collector.needsScores());
     for (LeafReaderContext context : getIndexReader().leaves()) {
-      BulkScorer scorer = weight.bulkScorer(context, context.reader().getLiveDocs());
+      BulkScorer scorer = weight.bulkScorer(context);
       if (scorer != null) {
         try {
-          scorer.score(collector.getLeafCollector(context));
+          scorer.score(collector.getLeafCollector(context), context.reader().getLiveDocs());
         } catch (CollectionTerminatedException e) {
           // collection was terminated prematurely
           // continue with the following leaf

Modified: lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingPostingsFormat.java?rev=1687581&r1=1687580&r2=1687581&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingPostingsFormat.java (original)
+++ lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingPostingsFormat.java Thu Jun 25 17:07:11 2015
@@ -187,7 +187,7 @@ public final class AssertingPostingsForm
             if (hasFreqs) {
               flags = flags | PostingsEnum.FREQS;
             }
-            postingsEnum = termsEnum.postings(null, postingsEnum, flags);
+            postingsEnum = termsEnum.postings(postingsEnum, flags);
           } else {
             flags = PostingsEnum.POSITIONS;
             if (hasPayloads) {
@@ -196,7 +196,7 @@ public final class AssertingPostingsForm
             if (hasOffsets) {
               flags = flags | PostingsEnum.OFFSETS;
             }
-            postingsEnum = termsEnum.postings(null, postingsEnum, flags);
+            postingsEnum = termsEnum.postings(postingsEnum, flags);
           }
 
           assert postingsEnum != null : "termsEnum=" + termsEnum + " hasPositions=" + hasPositions;

Modified: lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java?rev=1687581&r1=1687580&r2=1687581&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java (original)
+++ lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java Thu Jun 25 17:07:11 2015
@@ -47,7 +47,6 @@ import org.apache.lucene.store.IndexInpu
 import org.apache.lucene.store.IndexOutput;
 import org.apache.lucene.util.Accountable;
 import org.apache.lucene.util.Accountables;
-import org.apache.lucene.util.Bits;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.FixedBitSet;
 import org.apache.lucene.util.IOUtils;
@@ -299,7 +298,7 @@ public final class RAMOnlyPostingsFormat
             break;
           }
           RAMPostingsWriterImpl postingsWriter = termsConsumer.startTerm(term);
-          postingsEnum = termsEnum.postings(null, postingsEnum, enumFlags);
+          postingsEnum = termsEnum.postings(postingsEnum, enumFlags);
 
           int docFreq = 0;
           long totalTermFreq = 0;
@@ -485,22 +484,20 @@ public final class RAMOnlyPostingsFormat
     }
 
     @Override
-    public PostingsEnum postings(Bits liveDocs, PostingsEnum reuse, int flags) {
-      return new RAMDocsEnum(ramField.termToDocs.get(current), liveDocs);
+    public PostingsEnum postings(PostingsEnum reuse, int flags) {
+      return new RAMDocsEnum(ramField.termToDocs.get(current));
     }
 
   }
 
   private static class RAMDocsEnum extends PostingsEnum {
     private final RAMTerm ramTerm;
-    private final Bits liveDocs;
     private RAMDoc current;
     int upto = -1;
     int posUpto = 0;
 
-    public RAMDocsEnum(RAMTerm ramTerm, Bits liveDocs) {
+    public RAMDocsEnum(RAMTerm ramTerm) {
       this.ramTerm = ramTerm;
-      this.liveDocs = liveDocs;
     }
 
     @Override
@@ -511,17 +508,13 @@ public final class RAMOnlyPostingsFormat
     // TODO: override bulk read, for better perf
     @Override
     public int nextDoc() {
-      while(true) {
-        upto++;
-        if (upto < ramTerm.docs.size()) {
-          current = ramTerm.docs.get(upto);
-          if (liveDocs == null || liveDocs.get(current.docID)) {
-            posUpto = 0;
-            return current.docID;
-          }
-        } else {
-          return NO_MORE_DOCS;
-        }
+      upto++;
+      if (upto < ramTerm.docs.size()) {
+        current = ramTerm.docs.get(upto);
+        posUpto = 0;
+        return current.docID;
+      } else {
+        return NO_MORE_DOCS;
       }
     }
 

Modified: lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/index/AssertingLeafReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/index/AssertingLeafReader.java?rev=1687581&r1=1687580&r2=1687581&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/index/AssertingLeafReader.java (original)
+++ lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/index/AssertingLeafReader.java Thu Jun 25 17:07:11 2015
@@ -143,7 +143,7 @@ public class AssertingLeafReader extends
     }
 
     @Override
-    public PostingsEnum postings(Bits liveDocs, PostingsEnum reuse, int flags) throws IOException {
+    public PostingsEnum postings(PostingsEnum reuse, int flags) throws IOException {
       assertThread("Terms enums", creationThread);
       assert state == State.POSITIONED: "docs(...) called on unpositioned TermsEnum";
 
@@ -154,7 +154,7 @@ public class AssertingLeafReader extends
       } else {
         actualReuse = null;
       }
-      PostingsEnum docs = super.postings(liveDocs, actualReuse, flags);
+      PostingsEnum docs = super.postings(actualReuse, flags);
       if (docs == null) {
         assert PostingsEnum.featureRequested(flags, DocsAndPositionsEnum.OLD_NULL_SEMANTICS);
         return null;

Modified: lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java?rev=1687581&r1=1687580&r2=1687581&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java (original)
+++ lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java Thu Jun 25 17:07:11 2015
@@ -176,8 +176,8 @@ public abstract class BasePostingsFormat
   }
 
   protected static void checkReuse(TermsEnum termsEnum, int firstFlags, int secondFlags, boolean shouldReuse) throws IOException {
-    PostingsEnum postings1 = termsEnum.postings(null, null, firstFlags);
-    PostingsEnum postings2 = termsEnum.postings(null, postings1, secondFlags);
+    PostingsEnum postings1 = termsEnum.postings(null, firstFlags);
+    PostingsEnum postings2 = termsEnum.postings(postings1, secondFlags);
     if (shouldReuse)
       assertSame("Expected PostingsEnum " + postings1.getClass().getName() + " to be reused", postings1, postings2);
     else
@@ -247,7 +247,7 @@ public abstract class BasePostingsFormat
     LeafReader ar = getOnlySegmentReader(ir);
     TermsEnum termsEnum = ar.terms("field").iterator();
     assertTrue(termsEnum.seekExact(new BytesRef("value")));
-    PostingsEnum docsEnum = termsEnum.postings(null, null, PostingsEnum.NONE);
+    PostingsEnum docsEnum = termsEnum.postings(null, PostingsEnum.NONE);
     assertEquals(0, docsEnum.nextDoc());
     assertEquals(1, docsEnum.freq());
     assertEquals(1, docsEnum.nextDoc());
@@ -270,7 +270,7 @@ public abstract class BasePostingsFormat
     LeafReader ar = getOnlySegmentReader(ir);
     TermsEnum termsEnum = ar.terms("field").iterator();
     assertTrue(termsEnum.seekExact(new BytesRef("value")));
-    PostingsEnum docsEnum = termsEnum.postings(null, null, PostingsEnum.POSITIONS);
+    PostingsEnum docsEnum = termsEnum.postings(null, PostingsEnum.POSITIONS);
     assertEquals(0, docsEnum.nextDoc());
     assertEquals(1, docsEnum.freq());
     assertEquals(1, docsEnum.nextDoc());
@@ -306,7 +306,7 @@ public abstract class BasePostingsFormat
       TermsEnum termsEnum = terms.iterator();
       BytesRef term = termsEnum.next();
       if (term != null) {
-        PostingsEnum postingsEnum = termsEnum.postings(null, null);
+        PostingsEnum postingsEnum = termsEnum.postings(null);
         assertTrue(postingsEnum.nextDoc() == PostingsEnum.NO_MORE_DOCS);
       }
     }
@@ -398,9 +398,9 @@ public abstract class BasePostingsFormat
                       // TODO: also sometimes ask for payloads/offsets?
                       boolean noPositions = random().nextBoolean();
                       if (noPositions) {
-                        docs = termsEnum.postings(null, docs, PostingsEnum.FREQS);
+                        docs = termsEnum.postings(docs, PostingsEnum.FREQS);
                       } else {
-                        docs = termsEnum.postings(null, null, PostingsEnum.POSITIONS);
+                        docs = termsEnum.postings(null, PostingsEnum.POSITIONS);
                       }
                       int docFreq = 0;
                       long totalTermFreq = 0;
@@ -447,9 +447,9 @@ public abstract class BasePostingsFormat
                         // TODO: also sometimes ask for payloads/offsets?
                         boolean noPositions = random().nextBoolean();
                         if (noPositions) {
-                          docs = termsEnum.postings(null, docs, PostingsEnum.FREQS);
+                          docs = termsEnum.postings(docs, PostingsEnum.FREQS);
                         } else {
-                          docs = termsEnum.postings(null, null, PostingsEnum.POSITIONS);
+                          docs = termsEnum.postings(null, PostingsEnum.POSITIONS);
                         }
 
                         int docFreq = 0;
@@ -579,7 +579,7 @@ public abstract class BasePostingsFormat
     // termsenum reuse (FREQS)
     TermsEnum termsEnum = getOnlySegmentReader(reader).terms("foo").iterator();
     termsEnum.seekExact(new BytesRef("bar"));
-    PostingsEnum postings2 = termsEnum.postings(null, postings);
+    PostingsEnum postings2 = termsEnum.postings(postings);
     assertNotNull(postings2);
     assertReused("foo", postings, postings2);
     // and it had better work
@@ -590,13 +590,13 @@ public abstract class BasePostingsFormat
     
     // asking for any flags: ok
     for (int flag : new int[] { NONE, FREQS, POSITIONS, PAYLOADS, OFFSETS, ALL }) {
-      postings = termsEnum.postings(null, null, flag);
+      postings = termsEnum.postings(null, flag);
       assertEquals(-1, postings.docID());
       assertEquals(0, postings.nextDoc());
       assertEquals(1, postings.freq());
       assertEquals(DocIdSetIterator.NO_MORE_DOCS, postings.nextDoc());
       // reuse that too
-      postings2 = termsEnum.postings(null, postings, flag);
+      postings2 = termsEnum.postings(postings, flag);
       assertNotNull(postings2);
       assertReused("foo", postings, postings2);
       // and it had better work
@@ -637,7 +637,7 @@ public abstract class BasePostingsFormat
     // termsenum reuse (FREQS)
     TermsEnum termsEnum = getOnlySegmentReader(reader).terms("foo").iterator();
     termsEnum.seekExact(new BytesRef("bar"));
-    PostingsEnum postings2 = termsEnum.postings(null, postings);
+    PostingsEnum postings2 = termsEnum.postings(postings);
     assertNotNull(postings2);
     assertReused("foo", postings, postings2);
     // and it had better work
@@ -647,14 +647,14 @@ public abstract class BasePostingsFormat
     assertEquals(DocIdSetIterator.NO_MORE_DOCS, postings2.nextDoc());
     
     // asking for docs only: ok
-    PostingsEnum docsOnly = termsEnum.postings(null, null, PostingsEnum.NONE);
+    PostingsEnum docsOnly = termsEnum.postings(null, PostingsEnum.NONE);
     assertEquals(-1, docsOnly.docID());
     assertEquals(0, docsOnly.nextDoc());
     // we don't define what it is, but if its something else, we should look into it?
     assertTrue(docsOnly.freq() == 1 || docsOnly.freq() == 2);
     assertEquals(DocIdSetIterator.NO_MORE_DOCS, docsOnly.nextDoc());
     // reuse that too
-    PostingsEnum docsOnly2 = termsEnum.postings(null, docsOnly, PostingsEnum.NONE);
+    PostingsEnum docsOnly2 = termsEnum.postings(docsOnly, PostingsEnum.NONE);
     assertNotNull(docsOnly2);
     assertReused("foo", docsOnly, docsOnly2);
     // and it had better work
@@ -666,7 +666,7 @@ public abstract class BasePostingsFormat
     
     // asking for any flags: ok
     for (int flag : new int[] { NONE, FREQS, POSITIONS, PAYLOADS, OFFSETS, ALL }) {
-      postings = termsEnum.postings(null, null, flag);
+      postings = termsEnum.postings(null, flag);
       assertEquals(-1, postings.docID());
       assertEquals(0, postings.nextDoc());
       if (flag != NONE) {
@@ -674,7 +674,7 @@ public abstract class BasePostingsFormat
       }
       assertEquals(DocIdSetIterator.NO_MORE_DOCS, postings.nextDoc());
       // reuse that too
-      postings2 = termsEnum.postings(null, postings, flag);
+      postings2 = termsEnum.postings(postings, flag);
       assertNotNull(postings2);
       assertReused("foo", postings, postings2);
       // and it had better work
@@ -715,7 +715,7 @@ public abstract class BasePostingsFormat
     // termsenum reuse (FREQS)
     TermsEnum termsEnum = getOnlySegmentReader(reader).terms("foo").iterator();
     termsEnum.seekExact(new BytesRef("bar"));
-    PostingsEnum postings2 = termsEnum.postings(null, postings);
+    PostingsEnum postings2 = termsEnum.postings(postings);
     assertNotNull(postings2);
     assertReused("foo", postings, postings2);
     // and it had better work
@@ -725,14 +725,14 @@ public abstract class BasePostingsFormat
     assertEquals(DocIdSetIterator.NO_MORE_DOCS, postings2.nextDoc());
     
     // asking for docs only: ok
-    PostingsEnum docsOnly = termsEnum.postings(null, null, PostingsEnum.NONE);
+    PostingsEnum docsOnly = termsEnum.postings(null, PostingsEnum.NONE);
     assertEquals(-1, docsOnly.docID());
     assertEquals(0, docsOnly.nextDoc());
     // we don't define what it is, but if its something else, we should look into it?
     assertTrue(docsOnly.freq() == 1 || docsOnly.freq() == 2);
     assertEquals(DocIdSetIterator.NO_MORE_DOCS, docsOnly.nextDoc());
     // reuse that too
-    PostingsEnum docsOnly2 = termsEnum.postings(null, docsOnly, PostingsEnum.NONE);
+    PostingsEnum docsOnly2 = termsEnum.postings(docsOnly, PostingsEnum.NONE);
     assertNotNull(docsOnly2);
     assertReused("foo", docsOnly, docsOnly2);
     // and it had better work
@@ -758,7 +758,7 @@ public abstract class BasePostingsFormat
     assertEquals(DocIdSetIterator.NO_MORE_DOCS, docsAndPositionsEnum.nextDoc());
     
     // now reuse the positions
-    PostingsEnum docsAndPositionsEnum2 = termsEnum.postings(null, docsAndPositionsEnum, PostingsEnum.POSITIONS);
+    PostingsEnum docsAndPositionsEnum2 = termsEnum.postings(docsAndPositionsEnum, PostingsEnum.POSITIONS);
     assertReused("foo", docsAndPositionsEnum, docsAndPositionsEnum2);
     assertEquals(-1, docsAndPositionsEnum2.docID());
     assertEquals(0, docsAndPositionsEnum2.nextDoc());
@@ -790,7 +790,7 @@ public abstract class BasePostingsFormat
     assertNull(docsAndPositionsEnum.getPayload());
     assertEquals(DocIdSetIterator.NO_MORE_DOCS, docsAndPositionsEnum.nextDoc());
     // reuse
-    docsAndPositionsEnum2 = termsEnum.postings(null, docsAndPositionsEnum, PostingsEnum.PAYLOADS);
+    docsAndPositionsEnum2 = termsEnum.postings(docsAndPositionsEnum, PostingsEnum.PAYLOADS);
     assertReused("foo", docsAndPositionsEnum, docsAndPositionsEnum2);
     assertEquals(-1, docsAndPositionsEnum2.docID());
     assertEquals(0, docsAndPositionsEnum2.nextDoc());
@@ -820,7 +820,7 @@ public abstract class BasePostingsFormat
     assertNull(docsAndPositionsEnum.getPayload());
     assertEquals(DocIdSetIterator.NO_MORE_DOCS, docsAndPositionsEnum.nextDoc());
     // reuse
-    docsAndPositionsEnum2 = termsEnum.postings(null, docsAndPositionsEnum, PostingsEnum.OFFSETS);
+    docsAndPositionsEnum2 = termsEnum.postings(docsAndPositionsEnum, PostingsEnum.OFFSETS);
     assertReused("foo", docsAndPositionsEnum, docsAndPositionsEnum2);
     assertEquals(-1, docsAndPositionsEnum2.docID());
     assertEquals(0, docsAndPositionsEnum2.nextDoc());
@@ -849,7 +849,7 @@ public abstract class BasePostingsFormat
     assertEquals(-1, docsAndPositionsEnum.endOffset());
     assertNull(docsAndPositionsEnum.getPayload());
     assertEquals(DocIdSetIterator.NO_MORE_DOCS, docsAndPositionsEnum.nextDoc());
-    docsAndPositionsEnum2 = termsEnum.postings(null, docsAndPositionsEnum, PostingsEnum.ALL);
+    docsAndPositionsEnum2 = termsEnum.postings(docsAndPositionsEnum, PostingsEnum.ALL);
     assertReused("foo", docsAndPositionsEnum, docsAndPositionsEnum2);
     assertEquals(-1, docsAndPositionsEnum2.docID());
     assertEquals(0, docsAndPositionsEnum2.nextDoc());
@@ -895,7 +895,7 @@ public abstract class BasePostingsFormat
     // termsenum reuse (FREQS)
     TermsEnum termsEnum = getOnlySegmentReader(reader).terms("foo").iterator();
     termsEnum.seekExact(new BytesRef("bar"));
-    PostingsEnum postings2 = termsEnum.postings(null, postings);
+    PostingsEnum postings2 = termsEnum.postings(postings);
     assertNotNull(postings2);
     assertReused("foo", postings, postings2);
     // and it had better work
@@ -905,14 +905,14 @@ public abstract class BasePostingsFormat
     assertEquals(DocIdSetIterator.NO_MORE_DOCS, postings2.nextDoc());
     
     // asking for docs only: ok
-    PostingsEnum docsOnly = termsEnum.postings(null, null, PostingsEnum.NONE);
+    PostingsEnum docsOnly = termsEnum.postings(null, PostingsEnum.NONE);
     assertEquals(-1, docsOnly.docID());
     assertEquals(0, docsOnly.nextDoc());
     // we don't define what it is, but if its something else, we should look into it?
     assertTrue(docsOnly.freq() == 1 || docsOnly.freq() == 2);
     assertEquals(DocIdSetIterator.NO_MORE_DOCS, docsOnly.nextDoc());
     // reuse that too
-    PostingsEnum docsOnly2 = termsEnum.postings(null, docsOnly, PostingsEnum.NONE);
+    PostingsEnum docsOnly2 = termsEnum.postings(docsOnly, PostingsEnum.NONE);
     assertNotNull(docsOnly2);
     assertReused("foo", docsOnly, docsOnly2);
     // and it had better work
@@ -940,7 +940,7 @@ public abstract class BasePostingsFormat
     assertEquals(DocIdSetIterator.NO_MORE_DOCS, docsAndPositionsEnum.nextDoc());
     
     // now reuse the positions
-    PostingsEnum docsAndPositionsEnum2 = termsEnum.postings(null, docsAndPositionsEnum, PostingsEnum.POSITIONS);
+    PostingsEnum docsAndPositionsEnum2 = termsEnum.postings(docsAndPositionsEnum, PostingsEnum.POSITIONS);
     assertReused("foo", docsAndPositionsEnum, docsAndPositionsEnum2);
     assertEquals(-1, docsAndPositionsEnum2.docID());
     assertEquals(0, docsAndPositionsEnum2.nextDoc());
@@ -976,7 +976,7 @@ public abstract class BasePostingsFormat
     assertNull(docsAndPositionsEnum.getPayload());
     assertEquals(DocIdSetIterator.NO_MORE_DOCS, docsAndPositionsEnum.nextDoc());
     // reuse
-    docsAndPositionsEnum2 = termsEnum.postings(null, docsAndPositionsEnum, PostingsEnum.PAYLOADS);
+    docsAndPositionsEnum2 = termsEnum.postings(docsAndPositionsEnum, PostingsEnum.PAYLOADS);
     assertReused("foo", docsAndPositionsEnum, docsAndPositionsEnum2);
     assertEquals(-1, docsAndPositionsEnum2.docID());
     assertEquals(0, docsAndPositionsEnum2.nextDoc());
@@ -1008,7 +1008,7 @@ public abstract class BasePostingsFormat
     assertNull(docsAndPositionsEnum.getPayload());
     assertEquals(DocIdSetIterator.NO_MORE_DOCS, docsAndPositionsEnum.nextDoc());
     // reuse
-    docsAndPositionsEnum2 = termsEnum.postings(null, docsAndPositionsEnum, PostingsEnum.OFFSETS);
+    docsAndPositionsEnum2 = termsEnum.postings(docsAndPositionsEnum, PostingsEnum.OFFSETS);
     assertReused("foo", docsAndPositionsEnum, docsAndPositionsEnum2);
     assertEquals(-1, docsAndPositionsEnum2.docID());
     assertEquals(0, docsAndPositionsEnum2.nextDoc());
@@ -1037,7 +1037,7 @@ public abstract class BasePostingsFormat
     assertEquals(7, docsAndPositionsEnum.endOffset());
     assertNull(docsAndPositionsEnum.getPayload());
     assertEquals(DocIdSetIterator.NO_MORE_DOCS, docsAndPositionsEnum.nextDoc());
-    docsAndPositionsEnum2 = termsEnum.postings(null, docsAndPositionsEnum, PostingsEnum.ALL);
+    docsAndPositionsEnum2 = termsEnum.postings(docsAndPositionsEnum, PostingsEnum.ALL);
     assertReused("foo", docsAndPositionsEnum, docsAndPositionsEnum2);
     assertEquals(-1, docsAndPositionsEnum2.docID());
     assertEquals(0, docsAndPositionsEnum2.nextDoc());
@@ -1080,7 +1080,7 @@ public abstract class BasePostingsFormat
     // termsenum reuse (FREQS)
     TermsEnum termsEnum = getOnlySegmentReader(reader).terms("foo").iterator();
     termsEnum.seekExact(new BytesRef("bar"));
-    PostingsEnum postings2 = termsEnum.postings(null, postings);
+    PostingsEnum postings2 = termsEnum.postings(postings);
     assertNotNull(postings2);
     assertReused("foo", postings, postings2);
     // and it had better work
@@ -1090,14 +1090,14 @@ public abstract class BasePostingsFormat
     assertEquals(DocIdSetIterator.NO_MORE_DOCS, postings2.nextDoc());
     
     // asking for docs only: ok
-    PostingsEnum docsOnly = termsEnum.postings(null, null, PostingsEnum.NONE);
+    PostingsEnum docsOnly = termsEnum.postings(null, PostingsEnum.NONE);
     assertEquals(-1, docsOnly.docID());
     assertEquals(0, docsOnly.nextDoc());
     // we don't define what it is, but if its something else, we should look into it?
     assertTrue(docsOnly.freq() == 1 || docsOnly.freq() == 2);
     assertEquals(DocIdSetIterator.NO_MORE_DOCS, docsOnly.nextDoc());
     // reuse that too
-    PostingsEnum docsOnly2 = termsEnum.postings(null, docsOnly, PostingsEnum.NONE);
+    PostingsEnum docsOnly2 = termsEnum.postings(docsOnly, PostingsEnum.NONE);
     assertNotNull(docsOnly2);
     assertReused("foo", docsOnly, docsOnly2);
     // and it had better work
@@ -1125,7 +1125,7 @@ public abstract class BasePostingsFormat
     assertEquals(DocIdSetIterator.NO_MORE_DOCS, docsAndPositionsEnum.nextDoc());
     
     // now reuse the positions
-    PostingsEnum docsAndPositionsEnum2 = termsEnum.postings(null, docsAndPositionsEnum, PostingsEnum.POSITIONS);
+    PostingsEnum docsAndPositionsEnum2 = termsEnum.postings(docsAndPositionsEnum, PostingsEnum.POSITIONS);
     assertReused("foo", docsAndPositionsEnum, docsAndPositionsEnum2);
     assertEquals(-1, docsAndPositionsEnum2.docID());
     assertEquals(0, docsAndPositionsEnum2.nextDoc());
@@ -1158,7 +1158,7 @@ public abstract class BasePostingsFormat
     assertEquals(new BytesRef("pay2"), docsAndPositionsEnum.getPayload());
     assertEquals(DocIdSetIterator.NO_MORE_DOCS, docsAndPositionsEnum.nextDoc());
     // reuse
-    docsAndPositionsEnum2 = termsEnum.postings(null, docsAndPositionsEnum, PostingsEnum.PAYLOADS);
+    docsAndPositionsEnum2 = termsEnum.postings(docsAndPositionsEnum, PostingsEnum.PAYLOADS);
     assertReused("foo", docsAndPositionsEnum, docsAndPositionsEnum2);
     assertEquals(-1, docsAndPositionsEnum2.docID());
     assertEquals(0, docsAndPositionsEnum2.nextDoc());
@@ -1190,7 +1190,7 @@ public abstract class BasePostingsFormat
     assertTrue(docsAndPositionsEnum.getPayload() == null || new BytesRef("pay2").equals(docsAndPositionsEnum.getPayload()));
     assertEquals(DocIdSetIterator.NO_MORE_DOCS, docsAndPositionsEnum.nextDoc());
     // reuse
-    docsAndPositionsEnum2 = termsEnum.postings(null, docsAndPositionsEnum, PostingsEnum.OFFSETS);
+    docsAndPositionsEnum2 = termsEnum.postings(docsAndPositionsEnum, PostingsEnum.OFFSETS);
     assertReused("foo", docsAndPositionsEnum, docsAndPositionsEnum2);
     assertEquals(-1, docsAndPositionsEnum2.docID());
     assertEquals(0, docsAndPositionsEnum2.nextDoc());
@@ -1221,7 +1221,7 @@ public abstract class BasePostingsFormat
     assertEquals(-1, docsAndPositionsEnum.endOffset());
     assertEquals(new BytesRef("pay2"), docsAndPositionsEnum.getPayload());
     assertEquals(DocIdSetIterator.NO_MORE_DOCS, docsAndPositionsEnum.nextDoc());
-    docsAndPositionsEnum2 = termsEnum.postings(null, docsAndPositionsEnum, PostingsEnum.ALL);
+    docsAndPositionsEnum2 = termsEnum.postings(docsAndPositionsEnum, PostingsEnum.ALL);
     assertReused("foo", docsAndPositionsEnum, docsAndPositionsEnum2);
     assertEquals(-1, docsAndPositionsEnum2.docID());
     assertEquals(0, docsAndPositionsEnum2.nextDoc());
@@ -1266,7 +1266,7 @@ public abstract class BasePostingsFormat
     // termsenum reuse (FREQS)
     TermsEnum termsEnum = getOnlySegmentReader(reader).terms("foo").iterator();
     termsEnum.seekExact(new BytesRef("bar"));
-    PostingsEnum postings2 = termsEnum.postings(null, postings);
+    PostingsEnum postings2 = termsEnum.postings(postings);
     assertNotNull(postings2);
     assertReused("foo", postings, postings2);
     // and it had better work
@@ -1276,14 +1276,14 @@ public abstract class BasePostingsFormat
     assertEquals(DocIdSetIterator.NO_MORE_DOCS, postings2.nextDoc());
     
     // asking for docs only: ok
-    PostingsEnum docsOnly = termsEnum.postings(null, null, PostingsEnum.NONE);
+    PostingsEnum docsOnly = termsEnum.postings(null, PostingsEnum.NONE);
     assertEquals(-1, docsOnly.docID());
     assertEquals(0, docsOnly.nextDoc());
     // we don't define what it is, but if its something else, we should look into it?
     assertTrue(docsOnly.freq() == 1 || docsOnly.freq() == 2);
     assertEquals(DocIdSetIterator.NO_MORE_DOCS, docsOnly.nextDoc());
     // reuse that too
-    PostingsEnum docsOnly2 = termsEnum.postings(null, docsOnly, PostingsEnum.NONE);
+    PostingsEnum docsOnly2 = termsEnum.postings(docsOnly, PostingsEnum.NONE);
     assertNotNull(docsOnly2);
     assertReused("foo", docsOnly, docsOnly2);
     // and it had better work
@@ -1313,7 +1313,7 @@ public abstract class BasePostingsFormat
     assertEquals(DocIdSetIterator.NO_MORE_DOCS, docsAndPositionsEnum.nextDoc());
     
     // now reuse the positions
-    PostingsEnum docsAndPositionsEnum2 = termsEnum.postings(null, docsAndPositionsEnum, PostingsEnum.POSITIONS);
+    PostingsEnum docsAndPositionsEnum2 = termsEnum.postings(docsAndPositionsEnum, PostingsEnum.POSITIONS);
     assertReused("foo", docsAndPositionsEnum, docsAndPositionsEnum2);
     assertEquals(-1, docsAndPositionsEnum2.docID());
     assertEquals(0, docsAndPositionsEnum2.nextDoc());
@@ -1350,7 +1350,7 @@ public abstract class BasePostingsFormat
     assertEquals(new BytesRef("pay2"), docsAndPositionsEnum.getPayload());
     assertEquals(DocIdSetIterator.NO_MORE_DOCS, docsAndPositionsEnum.nextDoc());
     // reuse
-    docsAndPositionsEnum2 = termsEnum.postings(null, docsAndPositionsEnum, PostingsEnum.PAYLOADS);
+    docsAndPositionsEnum2 = termsEnum.postings(docsAndPositionsEnum, PostingsEnum.PAYLOADS);
     assertReused("foo", docsAndPositionsEnum, docsAndPositionsEnum2);
     assertEquals(-1, docsAndPositionsEnum2.docID());
     assertEquals(0, docsAndPositionsEnum2.nextDoc());
@@ -1384,7 +1384,7 @@ public abstract class BasePostingsFormat
     assertTrue(docsAndPositionsEnum.getPayload() == null || new BytesRef("pay2").equals(docsAndPositionsEnum.getPayload()));
     assertEquals(DocIdSetIterator.NO_MORE_DOCS, docsAndPositionsEnum.nextDoc());
     // reuse
-    docsAndPositionsEnum2 = termsEnum.postings(null, docsAndPositionsEnum, PostingsEnum.OFFSETS);
+    docsAndPositionsEnum2 = termsEnum.postings(docsAndPositionsEnum, PostingsEnum.OFFSETS);
     assertReused("foo", docsAndPositionsEnum, docsAndPositionsEnum2);
     assertEquals(-1, docsAndPositionsEnum2.docID());
     assertEquals(0, docsAndPositionsEnum2.nextDoc());
@@ -1415,7 +1415,7 @@ public abstract class BasePostingsFormat
     assertEquals(7, docsAndPositionsEnum.endOffset());
     assertEquals(new BytesRef("pay2"), docsAndPositionsEnum.getPayload());
     assertEquals(DocIdSetIterator.NO_MORE_DOCS, docsAndPositionsEnum.nextDoc());
-    docsAndPositionsEnum2 = termsEnum.postings(null, docsAndPositionsEnum, PostingsEnum.ALL);
+    docsAndPositionsEnum2 = termsEnum.postings(docsAndPositionsEnum, PostingsEnum.ALL);
     assertReused("foo", docsAndPositionsEnum, docsAndPositionsEnum2);
     assertEquals(-1, docsAndPositionsEnum2.docID());
     assertEquals(0, docsAndPositionsEnum2.nextDoc());



Mime
View raw message