lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpou...@apache.org
Subject svn commit: r1687524 [5/7] - in /lucene/dev/trunk: 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/lucene/analysis/sta...
Date Thu, 25 Jun 2015 13:59:21 GMT
Modified: lucene/dev/trunk/lucene/join/src/java/org/apache/lucene/search/join/ToChildBlockJoinQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/join/src/java/org/apache/lucene/search/join/ToChildBlockJoinQuery.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/join/src/java/org/apache/lucene/search/join/ToChildBlockJoinQuery.java (original)
+++ lucene/dev/trunk/lucene/join/src/java/org/apache/lucene/search/join/ToChildBlockJoinQuery.java Thu Jun 25 13:59:19 2015
@@ -33,7 +33,6 @@ import org.apache.lucene.search.Scorer;
 import org.apache.lucene.search.Weight;
 import org.apache.lucene.util.BitDocIdSet;
 import org.apache.lucene.util.BitSet;
-import org.apache.lucene.util.Bits;
 
 /**
  * Just like {@link ToParentBlockJoinQuery}, except this
@@ -122,9 +121,9 @@ public class ToChildBlockJoinQuery exten
     // NOTE: acceptDocs applies (and is checked) only in the
     // child document space
     @Override
-    public Scorer scorer(LeafReaderContext readerContext, Bits acceptDocs) throws IOException {
+    public Scorer scorer(LeafReaderContext readerContext) throws IOException {
 
-      final Scorer parentScorer = parentWeight.scorer(readerContext, null);
+      final Scorer parentScorer = parentWeight.scorer(readerContext);
 
       if (parentScorer == null) {
         // No matches
@@ -139,12 +138,12 @@ public class ToChildBlockJoinQuery exten
         return null;
       }
 
-      return new ToChildBlockJoinScorer(this, parentScorer, parents.bits(), doScores, acceptDocs);
+      return new ToChildBlockJoinScorer(this, parentScorer, parents.bits(), doScores);
     }
 
     @Override
     public Explanation explain(LeafReaderContext context, int doc) throws IOException {
-      ToChildBlockJoinScorer scorer = (ToChildBlockJoinScorer) scorer(context, context.reader().getLiveDocs());
+      ToChildBlockJoinScorer scorer = (ToChildBlockJoinScorer) scorer(context);
       if (scorer != null && scorer.advance(doc) == doc) {
         int parentDoc = scorer.getParentDoc();
         return Explanation.match(
@@ -161,7 +160,6 @@ public class ToChildBlockJoinQuery exten
     private final Scorer parentScorer;
     private final BitSet parentBits;
     private final boolean doScores;
-    private final Bits acceptDocs;
 
     private float parentScore;
     private int parentFreq = 1;
@@ -169,12 +167,11 @@ public class ToChildBlockJoinQuery exten
     private int childDoc = -1;
     private int parentDoc = 0;
 
-    public ToChildBlockJoinScorer(Weight weight, Scorer parentScorer, BitSet parentBits, boolean doScores, Bits acceptDocs) {
+    public ToChildBlockJoinScorer(Weight weight, Scorer parentScorer, BitSet parentBits, boolean doScores) {
       super(weight);
       this.doScores = doScores;
       this.parentBits = parentBits;
       this.parentScorer = parentScorer;
-      this.acceptDocs = acceptDocs;
     }
 
     @Override
@@ -186,8 +183,6 @@ public class ToChildBlockJoinQuery exten
     public int nextDoc() throws IOException {
       //System.out.println("Q.nextDoc() parentDoc=" + parentDoc + " childDoc=" + childDoc);
 
-      // Loop until we hit a childDoc that's accepted
-      nextChildDoc:
       while (true) {
         if (childDoc+1 == parentDoc) {
           // OK, we are done iterating through all children
@@ -224,20 +219,6 @@ public class ToChildBlockJoinQuery exten
               continue;
             }
 
-            if (acceptDocs != null && !acceptDocs.get(childDoc)) {
-              // find the first child that is accepted
-              while (true) {
-                if (childDoc+1 < parentDoc) {
-                  childDoc++;
-                  if (acceptDocs.get(childDoc))
-                    break;
-                } else {
-                  // no child for this parent doc matches acceptDocs
-                  continue nextChildDoc;
-                }
-              }
-            }
-
             if (childDoc < parentDoc) {
               if (doScores) {
                 parentScore = parentScorer.score();
@@ -252,9 +233,6 @@ public class ToChildBlockJoinQuery exten
         } else {
           assert childDoc < parentDoc: "childDoc=" + childDoc + " parentDoc=" + parentDoc;
           childDoc++;
-          if (acceptDocs != null && !acceptDocs.get(childDoc)) {
-            continue;
-          }
           //System.out.println("  " + childDoc);
           return childDoc;
         }
@@ -323,9 +301,6 @@ public class ToChildBlockJoinQuery exten
       assert !parentBits.get(childTarget);
       childDoc = childTarget;
       //System.out.println("  " + childDoc);
-      if (acceptDocs != null && !acceptDocs.get(childDoc)) {
-        nextDoc();
-      }
       return childDoc;
     }
 

Modified: lucene/dev/trunk/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinIndexSearcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinIndexSearcher.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinIndexSearcher.java (original)
+++ lucene/dev/trunk/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinIndexSearcher.java Thu Jun 25 13:59:19 2015
@@ -21,7 +21,6 @@ import java.io.IOException;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
 
-import org.apache.lucene.index.PostingsEnum;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.LeafReaderContext;
 import org.apache.lucene.search.Collector;
@@ -30,6 +29,7 @@ import org.apache.lucene.search.IndexSea
 import org.apache.lucene.search.LeafCollector;
 import org.apache.lucene.search.Scorer;
 import org.apache.lucene.search.Weight;
+import org.apache.lucene.util.Bits;
 
 /**
  * An {@link IndexSearcher} to use in conjunction with
@@ -56,12 +56,15 @@ public class ToParentBlockJoinIndexSearc
       // we force the use of Scorer (not BulkScorer) to make sure
       // that the scorer passed to LeafCollector.setScorer supports
       // Scorer.getChildren
-      Scorer scorer = weight.scorer(ctx, ctx.reader().getLiveDocs());
+      Scorer scorer = weight.scorer(ctx);
       if (scorer != null) {
         final LeafCollector leafCollector = collector.getLeafCollector(ctx);
         leafCollector.setScorer(scorer);
+        final Bits liveDocs = ctx.reader().getLiveDocs();
         for (int doc = scorer.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = scorer.nextDoc()) {
-          leafCollector.collect(doc);
+          if (liveDocs == null || liveDocs.get(doc)) {
+            leafCollector.collect(doc);
+          }
         }
       }
     }

Modified: lucene/dev/trunk/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinQuery.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinQuery.java (original)
+++ lucene/dev/trunk/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinQuery.java Thu Jun 25 13:59:19 2015
@@ -157,9 +157,9 @@ public class ToParentBlockJoinQuery exte
     // NOTE: acceptDocs applies (and is checked) only in the
     // parent document space
     @Override
-    public Scorer scorer(LeafReaderContext readerContext, Bits acceptDocs) throws IOException {
+    public Scorer scorer(LeafReaderContext readerContext) throws IOException {
 
-      final Scorer childScorer = childWeight.scorer(readerContext, readerContext.reader().getLiveDocs());
+      final Scorer childScorer = childWeight.scorer(readerContext);
       if (childScorer == null) {
         // No matches
         return null;
@@ -180,12 +180,12 @@ public class ToParentBlockJoinQuery exte
         return null;
       }
 
-      return new BlockJoinScorer(this, childScorer, parents.bits(), firstChildDoc, scoreMode, acceptDocs);
+      return new BlockJoinScorer(this, childScorer, parents.bits(), firstChildDoc, scoreMode);
     }
 
     @Override
     public Explanation explain(LeafReaderContext context, int doc) throws IOException {
-      BlockJoinScorer scorer = (BlockJoinScorer) scorer(context, context.reader().getLiveDocs());
+      BlockJoinScorer scorer = (BlockJoinScorer) scorer(context);
       if (scorer != null && scorer.advance(doc) == doc) {
         return scorer.explain(context.docBase);
       }
@@ -197,7 +197,6 @@ public class ToParentBlockJoinQuery exte
     private final Scorer childScorer;
     private final BitSet parentBits;
     private final ScoreMode scoreMode;
-    private final Bits acceptDocs;
     private int parentDoc = -1;
     private int prevParentDoc;
     private float parentScore;
@@ -207,13 +206,12 @@ public class ToParentBlockJoinQuery exte
     private float[] pendingChildScores;
     private int childDocUpto;
 
-    public BlockJoinScorer(Weight weight, Scorer childScorer, BitSet parentBits, int firstChildDoc, ScoreMode scoreMode, Bits acceptDocs) {
+    public BlockJoinScorer(Weight weight, Scorer childScorer, BitSet parentBits, int firstChildDoc, ScoreMode scoreMode) {
       super(weight);
       //System.out.println("Q.init firstChildDoc=" + firstChildDoc);
       this.parentBits = parentBits;
       this.childScorer = childScorer;
       this.scoreMode = scoreMode;
-      this.acceptDocs = acceptDocs;
       nextChildDoc = firstChildDoc;
     }
 
@@ -256,104 +254,84 @@ public class ToParentBlockJoinQuery exte
     @Override
     public int nextDoc() throws IOException {
       //System.out.println("Q.nextDoc() nextChildDoc=" + nextChildDoc);
-      // Loop until we hit a parentDoc that's accepted
-      while (true) {
-        if (nextChildDoc == NO_MORE_DOCS) {
-          //System.out.println("  end");
-          return parentDoc = NO_MORE_DOCS;
-        }
+      if (nextChildDoc == NO_MORE_DOCS) {
+        //System.out.println("  end");
+        return parentDoc = NO_MORE_DOCS;
+      }
 
-        // Gather all children sharing the same parent as
-        // nextChildDoc
+      // Gather all children sharing the same parent as
+      // nextChildDoc
 
-        parentDoc = parentBits.nextSetBit(nextChildDoc);
+      parentDoc = parentBits.nextSetBit(nextChildDoc);
 
-        // Parent & child docs are supposed to be
-        // orthogonal:
-        if (nextChildDoc == parentDoc) {
-          throw new IllegalStateException("child query must only match non-parent docs, but parent docID=" + nextChildDoc + " matched childScorer=" + childScorer.getClass());
-        }
+      // Parent & child docs are supposed to be
+      // orthogonal:
+      if (nextChildDoc == parentDoc) {
+        throw new IllegalStateException("child query must only match non-parent docs, but parent docID=" + nextChildDoc + " matched childScorer=" + childScorer.getClass());
+      }
 
-        //System.out.println("  parentDoc=" + parentDoc);
-        assert parentDoc != DocIdSetIterator.NO_MORE_DOCS;
+      //System.out.println("  parentDoc=" + parentDoc);
+      assert parentDoc != DocIdSetIterator.NO_MORE_DOCS;
 
-        //System.out.println("  nextChildDoc=" + nextChildDoc);
-        if (acceptDocs != null && !acceptDocs.get(parentDoc)) {
-          // Parent doc not accepted; skip child docs until
-          // we hit a new parent doc:
-          do {
-            nextChildDoc = childScorer.nextDoc();
-          } while (nextChildDoc < parentDoc);
-
-          // Parent & child docs are supposed to be
-          // orthogonal:
-          if (nextChildDoc == parentDoc) {
-            throw new IllegalStateException("child query must only match non-parent docs, but parent docID=" + nextChildDoc + " matched childScorer=" + childScorer.getClass());
-          }
+      float totalScore = 0;
+      float maxScore = Float.NEGATIVE_INFINITY;
+      float minScore = Float.POSITIVE_INFINITY;
 
-          continue;
-        }
+      childDocUpto = 0;
+      parentFreq = 0;
+      do {
 
-        float totalScore = 0;
-        float maxScore = Float.NEGATIVE_INFINITY;
-        float minScore = Float.POSITIVE_INFINITY;
-
-        childDocUpto = 0;
-        parentFreq = 0;
-        do {
-
-          //System.out.println("  c=" + nextChildDoc);
-          if (pendingChildDocs != null && pendingChildDocs.length == childDocUpto) {
-            pendingChildDocs = ArrayUtil.grow(pendingChildDocs);
-          }
-          if (pendingChildScores != null && scoreMode != ScoreMode.None && pendingChildScores.length == childDocUpto) {
-            pendingChildScores = ArrayUtil.grow(pendingChildScores);
-          }
-          if (pendingChildDocs != null) {
-            pendingChildDocs[childDocUpto] = nextChildDoc;
-          }
-          if (scoreMode != ScoreMode.None) {
-            // TODO: specialize this into dedicated classes per-scoreMode
-            final float childScore = childScorer.score();
-            final int childFreq = childScorer.freq();
-            if (pendingChildScores != null) {
-              pendingChildScores[childDocUpto] = childScore;
-            }
-            maxScore = Math.max(childScore, maxScore);
-            minScore = Math.min(childFreq, minScore);
-            totalScore += childScore;
-            parentFreq += childFreq;
-          }
-          childDocUpto++;
-          nextChildDoc = childScorer.nextDoc();
-        } while (nextChildDoc < parentDoc);
-
-        // Parent & child docs are supposed to be
-        // orthogonal:
-        if (nextChildDoc == parentDoc) {
-          throw new IllegalStateException("child query must only match non-parent docs, but parent docID=" + nextChildDoc + " matched childScorer=" + childScorer.getClass());
+        //System.out.println("  c=" + nextChildDoc);
+        if (pendingChildDocs != null && pendingChildDocs.length == childDocUpto) {
+          pendingChildDocs = ArrayUtil.grow(pendingChildDocs);
         }
-
-        switch(scoreMode) {
-        case Avg:
-          parentScore = totalScore / childDocUpto;
-          break;
-        case Max:
-          parentScore = maxScore;
-          break;
-        case Min:
-          parentScore = minScore;
-          break;
-        case Total:
-          parentScore = totalScore;
-          break;
-        case None:
-          break;
+        if (pendingChildScores != null && scoreMode != ScoreMode.None && pendingChildScores.length == childDocUpto) {
+          pendingChildScores = ArrayUtil.grow(pendingChildScores);
         }
-
-        //System.out.println("  return parentDoc=" + parentDoc + " childDocUpto=" + childDocUpto);
-        return parentDoc;
+        if (pendingChildDocs != null) {
+          pendingChildDocs[childDocUpto] = nextChildDoc;
+        }
+        if (scoreMode != ScoreMode.None) {
+          // TODO: specialize this into dedicated classes per-scoreMode
+          final float childScore = childScorer.score();
+          final int childFreq = childScorer.freq();
+          if (pendingChildScores != null) {
+            pendingChildScores[childDocUpto] = childScore;
+          }
+          maxScore = Math.max(childScore, maxScore);
+          minScore = Math.min(childFreq, minScore);
+          totalScore += childScore;
+          parentFreq += childFreq;
+        }
+        childDocUpto++;
+        nextChildDoc = childScorer.nextDoc();
+      } while (nextChildDoc < parentDoc);
+
+      // Parent & child docs are supposed to be
+      // orthogonal:
+      if (nextChildDoc == parentDoc) {
+        throw new IllegalStateException("child query must only match non-parent docs, but parent docID=" + nextChildDoc + " matched childScorer=" + childScorer.getClass());
+      }
+
+      switch(scoreMode) {
+      case Avg:
+        parentScore = totalScore / childDocUpto;
+        break;
+      case Max:
+        parentScore = maxScore;
+        break;
+      case Min:
+        parentScore = minScore;
+        break;
+      case Total:
+        parentScore = totalScore;
+        break;
+      case None:
+        break;
       }
+
+      //System.out.println("  return parentDoc=" + parentDoc + " childDocUpto=" + childDocUpto);
+      return parentDoc;
     }
 
     @Override

Modified: lucene/dev/trunk/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoin.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoin.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoin.java (original)
+++ lucene/dev/trunk/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoin.java Thu Jun 25 13:59:19 2015
@@ -55,6 +55,7 @@ import org.apache.lucene.search.FieldDoc
 import org.apache.lucene.search.Filter;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.MatchAllDocsQuery;
+import org.apache.lucene.search.MatchNoDocsQuery;
 import org.apache.lucene.search.MultiTermQuery;
 import org.apache.lucene.search.NumericRangeQuery;
 import org.apache.lucene.search.PrefixQuery;
@@ -444,7 +445,7 @@ public class TestBlockJoin extends Lucen
     w.close();
     IndexSearcher s = newSearcher(r);
     
-    ToParentBlockJoinQuery q = new ToParentBlockJoinQuery(new MatchAllDocsQuery(), new BitDocIdSetCachingWrapperFilter(new QueryWrapperFilter(new MatchAllDocsQuery())), ScoreMode.Avg);
+    ToParentBlockJoinQuery q = new ToParentBlockJoinQuery(new MatchNoDocsQuery(), new BitDocIdSetCachingWrapperFilter(new QueryWrapperFilter(new MatchAllDocsQuery())), ScoreMode.Avg);
     QueryUtils.check(random(), q, s);
     s.search(q, 10);
     BooleanQuery.Builder bqB = new BooleanQuery.Builder();
@@ -456,61 +457,6 @@ public class TestBlockJoin extends Lucen
     dir.close();
   }
 
-  public void testNestedDocScoringWithDeletes() throws Exception {
-    final Directory dir = newDirectory();
-    final RandomIndexWriter w = new RandomIndexWriter(
-        random(),
-        dir,
-        newIndexWriterConfig(new MockAnalyzer(random())).setMergePolicy(NoMergePolicy.INSTANCE));
-
-    // Cannot assert this since we use NoMergePolicy:
-    w.setDoRandomForceMergeAssert(false);
-
-    List<Document> docs = new ArrayList<>();
-    docs.add(makeJob("java", 2007));
-    docs.add(makeJob("python", 2010));
-    docs.add(makeResume("Lisa", "United Kingdom"));
-    w.addDocuments(docs);
-
-    docs.clear();
-    docs.add(makeJob("c", 1999));
-    docs.add(makeJob("ruby", 2005));
-    docs.add(makeJob("java", 2006));
-    docs.add(makeResume("Frank", "United States"));
-    w.addDocuments(docs);
-
-    w.commit();
-    IndexSearcher s = newSearcher(DirectoryReader.open(dir));
-
-    ToParentBlockJoinQuery q = new ToParentBlockJoinQuery(
-        NumericRangeQuery.newIntRange("year", 1990, 2010, true, true),
-        new BitDocIdSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("docType", "resume")))),
-        ScoreMode.Total
-    );
-
-    TopDocs topDocs = s.search(q, 10);
-    assertEquals(2, topDocs.totalHits);
-    assertEquals(6, topDocs.scoreDocs[0].doc);
-    assertEquals(3.0f, topDocs.scoreDocs[0].score, 0.0f);
-    assertEquals(2, topDocs.scoreDocs[1].doc);
-    assertEquals(2.0f, topDocs.scoreDocs[1].score, 0.0f);
-
-    s.getIndexReader().close();
-    w.deleteDocuments(new Term("skill", "java"));
-    w.close();
-    s = newSearcher(DirectoryReader.open(dir));
-
-    topDocs = s.search(q, 10);
-    assertEquals(2, topDocs.totalHits);
-    assertEquals(6, topDocs.scoreDocs[0].doc);
-    assertEquals(2.0f, topDocs.scoreDocs[0].score, 0.0f);
-    assertEquals(2, topDocs.scoreDocs[1].doc);
-    assertEquals(1.0f, topDocs.scoreDocs[1].score, 0.0f);
-
-    s.getIndexReader().close();
-    dir.close();
-  }
-
   private String[][] getRandomFields(int maxUniqueValues) {
 
     final String[][] fields = new String[TestUtil.nextInt(random(), 2, 4)][];
@@ -699,7 +645,7 @@ public class TestBlockJoin extends Lucen
       for(int docIDX=0;docIDX<joinR.maxDoc();docIDX++) {
         System.out.println("  docID=" + docIDX + " doc=" + joinR.document(docIDX) + " deleted?=" + (liveDocs != null && liveDocs.get(docIDX) == false));
       }
-      PostingsEnum parents = MultiFields.getTermDocsEnum(joinR, null, "isParent", new BytesRef("x"));
+      PostingsEnum parents = MultiFields.getTermDocsEnum(joinR, "isParent", new BytesRef("x"));
       System.out.println("parent docIDs:");
       while (parents.nextDoc() != PostingsEnum.NO_MORE_DOCS) {
         System.out.println("  " + parents.docID());
@@ -1207,7 +1153,7 @@ public class TestBlockJoin extends Lucen
 
     ToParentBlockJoinQuery q = new ToParentBlockJoinQuery(tq, parentFilter, ScoreMode.Avg);
     Weight weight = s.createNormalizedWeight(q, true);
-    DocIdSetIterator disi = weight.scorer(s.getIndexReader().leaves().get(0), null);
+    DocIdSetIterator disi = weight.scorer(s.getIndexReader().leaves().get(0));
     assertEquals(1, disi.advance(1));
     r.close();
     dir.close();
@@ -1241,7 +1187,7 @@ public class TestBlockJoin extends Lucen
 
     ToParentBlockJoinQuery q = new ToParentBlockJoinQuery(tq, parentFilter, ScoreMode.Avg);
     Weight weight = s.createNormalizedWeight(q, true);
-    DocIdSetIterator disi = weight.scorer(s.getIndexReader().leaves().get(0), null);
+    DocIdSetIterator disi = weight.scorer(s.getIndexReader().leaves().get(0));
     assertEquals(2, disi.advance(0));
     r.close();
     dir.close();
@@ -1284,7 +1230,7 @@ public class TestBlockJoin extends Lucen
     s.search(childJoinQuery, c);
 
     //Get all child documents within groups
-    @SuppressWarnings({"unchecked","rawtypes"})
+    @SuppressWarnings({"unchecked"})
     TopGroups<Integer>[] getTopGroupsResults = new TopGroups[2];
     getTopGroupsResults[0] = c.getTopGroups(childJoinQuery, null, 0, 10, 0, true);
     getTopGroupsResults[1] = c.getTopGroupsWithAllChildDocs(childJoinQuery, null, 0, 0, true);

Modified: lucene/dev/trunk/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoinValidation.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoinValidation.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoinValidation.java (original)
+++ lucene/dev/trunk/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoinValidation.java Thu Jun 25 13:59:19 2015
@@ -131,7 +131,7 @@ public class TestBlockJoinValidation ext
 
     final LeafReaderContext context = indexSearcher.getIndexReader().leaves().get(0);
     Weight weight = indexSearcher.createNormalizedWeight(blockJoinQuery, true);
-    Scorer scorer = weight.scorer(context, context.reader().getLiveDocs());
+    Scorer scorer = weight.scorer(context);
     final Bits parentDocs = parentsFilter.getDocIdSet(context).bits();
 
     int target;

Modified: lucene/dev/trunk/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java (original)
+++ lucene/dev/trunk/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java Thu Jun 25 13:59:19 2015
@@ -370,8 +370,8 @@ public class TestJoinUtil extends Lucene
           }
 
           @Override
-          public Scorer scorer(LeafReaderContext context, Bits acceptDocs) throws IOException {
-            Scorer fieldScorer = fieldWeight.scorer(context, acceptDocs);
+          public Scorer scorer(LeafReaderContext context) throws IOException {
+            Scorer fieldScorer = fieldWeight.scorer(context);
             NumericDocValues price = context.reader().getNumericDocValues(priceField);
             return new FilterScorer(fieldScorer, this) {
               @Override
@@ -1096,7 +1096,7 @@ public class TestJoinUtil extends Lucene
           for (BytesRef joinValue : joinValues) {
             TermsEnum termsEnum = terms.iterator();
             if (termsEnum.seekExact(joinValue)) {
-              postingsEnum = termsEnum.postings(slowCompositeReader.getLiveDocs(), postingsEnum, PostingsEnum.NONE);
+              postingsEnum = termsEnum.postings(postingsEnum, PostingsEnum.NONE);
               JoinScore joinScore = joinValueToJoinScores.get(joinValue);
 
               for (int doc = postingsEnum.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = postingsEnum.nextDoc()) {
@@ -1219,7 +1219,7 @@ public class TestJoinUtil extends Lucene
         }
 
         for (RandomDoc otherSideDoc : otherMatchingDocs) {
-          PostingsEnum postingsEnum = MultiFields.getTermDocsEnum(topLevelReader, MultiFields.getLiveDocs(topLevelReader), "id", new BytesRef(otherSideDoc.id), 0);
+          PostingsEnum postingsEnum = MultiFields.getTermDocsEnum(topLevelReader, "id", new BytesRef(otherSideDoc.id), 0);
           assert postingsEnum != null;
           int doc = postingsEnum.nextDoc();
           expectedResult.set(doc);

Modified: lucene/dev/trunk/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java (original)
+++ lucene/dev/trunk/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java Thu Jun 25 13:59:19 2015
@@ -989,12 +989,12 @@ public class MemoryIndex {
       }
 
       @Override
-      public PostingsEnum postings(Bits liveDocs, PostingsEnum reuse, int flags) {
+      public PostingsEnum postings(PostingsEnum reuse, int flags) {
         if (reuse == null || !(reuse instanceof MemoryPostingsEnum)) {
           reuse = new MemoryPostingsEnum();
         }
         final int ord = info.sortedTerms[termUpto];
-        return ((MemoryPostingsEnum) reuse).reset(liveDocs, info.sliceArray.start[ord], info.sliceArray.end[ord], info.sliceArray.freq[ord]);
+        return ((MemoryPostingsEnum) reuse).reset(info.sliceArray.start[ord], info.sliceArray.end[ord], info.sliceArray.freq[ord]);
       }
 
       @Override
@@ -1016,7 +1016,6 @@ public class MemoryIndex {
       private final SliceReader sliceReader;
       private int posUpto; // for assert
       private boolean hasNext;
-      private Bits liveDocs;
       private int doc = -1;
       private int freq;
       private int pos;
@@ -1030,8 +1029,7 @@ public class MemoryIndex {
         this.payloadBuilder = storePayloads ? new BytesRefBuilder() : null;
       }
 
-      public PostingsEnum reset(Bits liveDocs, int start, int end, int freq) {
-        this.liveDocs = liveDocs;
+      public PostingsEnum reset(int start, int end, int freq) {
         this.sliceReader.reset(start, end);
         posUpto = 0; // for assert
         hasNext = true;
@@ -1049,7 +1047,7 @@ public class MemoryIndex {
       @Override
       public int nextDoc() {
         pos = -1;
-        if (hasNext && (liveDocs == null || liveDocs.get(0))) {
+        if (hasNext) {
           hasNext = false;
           return doc = 0;
         } else {

Modified: lucene/dev/trunk/lucene/memory/src/test/org/apache/lucene/index/memory/TestMemoryIndexAgainstRAMDir.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/memory/src/test/org/apache/lucene/index/memory/TestMemoryIndexAgainstRAMDir.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/memory/src/test/org/apache/lucene/index/memory/TestMemoryIndexAgainstRAMDir.java (original)
+++ lucene/dev/trunk/lucene/memory/src/test/org/apache/lucene/index/memory/TestMemoryIndexAgainstRAMDir.java Thu Jun 25 13:59:19 2015
@@ -199,8 +199,8 @@ public class TestMemoryIndexAgainstRAMDi
           while(iwTermsIter.next() != null) {
             assertNotNull(memTermsIter.next());
             assertEquals(iwTermsIter.term(), memTermsIter.term());
-            PostingsEnum iwDocsAndPos = iwTermsIter.postings(null, null, PostingsEnum.ALL);
-            PostingsEnum memDocsAndPos = memTermsIter.postings(null, null, PostingsEnum.ALL);
+            PostingsEnum iwDocsAndPos = iwTermsIter.postings(null, PostingsEnum.ALL);
+            PostingsEnum memDocsAndPos = memTermsIter.postings(null, PostingsEnum.ALL);
             while(iwDocsAndPos.nextDoc() != PostingsEnum.NO_MORE_DOCS) {
               assertEquals(iwDocsAndPos.docID(), memDocsAndPos.nextDoc());
               assertEquals(iwDocsAndPos.freq(), memDocsAndPos.freq());
@@ -222,8 +222,8 @@ public class TestMemoryIndexAgainstRAMDi
         } else {
           while(iwTermsIter.next() != null) {
             assertEquals(iwTermsIter.term(), memTermsIter.term());
-            PostingsEnum iwDocsAndPos = iwTermsIter.postings(null, null);
-            PostingsEnum memDocsAndPos = memTermsIter.postings(null, null);
+            PostingsEnum iwDocsAndPos = iwTermsIter.postings(null);
+            PostingsEnum memDocsAndPos = memTermsIter.postings(null);
             while(iwDocsAndPos.nextDoc() != PostingsEnum.NO_MORE_DOCS) {
               assertEquals(iwDocsAndPos.docID(), memDocsAndPos.nextDoc());
               assertEquals(iwDocsAndPos.freq(), memDocsAndPos.freq());
@@ -320,7 +320,7 @@ public class TestMemoryIndexAgainstRAMDi
     memory.addField("foo", "bar", analyzer);
     LeafReader reader = (LeafReader) memory.createSearcher().getIndexReader();
     TestUtil.checkReader(reader);
-    PostingsEnum disi = TestUtil.docs(random(), reader, "foo", new BytesRef("bar"), null, null, PostingsEnum.NONE);
+    PostingsEnum disi = TestUtil.docs(random(), reader, "foo", new BytesRef("bar"), null, PostingsEnum.NONE);
     int docid = disi.docID();
     assertEquals(-1, docid);
     assertTrue(disi.nextDoc() != DocIdSetIterator.NO_MORE_DOCS);
@@ -328,7 +328,7 @@ public class TestMemoryIndexAgainstRAMDi
     // now reuse and check again
     TermsEnum te = reader.terms("foo").iterator();
     assertTrue(te.seekExact(new BytesRef("bar")));
-    disi = te.postings(null, disi, PostingsEnum.NONE);
+    disi = te.postings(disi, PostingsEnum.NONE);
     docid = disi.docID();
     assertEquals(-1, docid);
     assertTrue(disi.nextDoc() != DocIdSetIterator.NO_MORE_DOCS);
@@ -367,7 +367,7 @@ public class TestMemoryIndexAgainstRAMDi
       // now reuse and check again
       TermsEnum te = reader.terms("foo").iterator();
       assertTrue(te.seekExact(new BytesRef("bar")));
-      disi = te.postings(null, disi);
+      disi = te.postings(disi);
       docid = disi.docID();
       assertEquals(-1, docid);
       assertTrue(disi.nextDoc() != DocIdSetIterator.NO_MORE_DOCS);
@@ -534,8 +534,8 @@ public class TestMemoryIndexAgainstRAMDi
       assertNotNull(memTermEnum.next());
       assertThat(termEnum.totalTermFreq(), equalTo(memTermEnum.totalTermFreq()));
 
-      PostingsEnum docsPosEnum = termEnum.postings(null, null, PostingsEnum.POSITIONS);
-      PostingsEnum memDocsPosEnum = memTermEnum.postings(null, null, PostingsEnum.POSITIONS);
+      PostingsEnum docsPosEnum = termEnum.postings(null, PostingsEnum.POSITIONS);
+      PostingsEnum memDocsPosEnum = memTermEnum.postings(null, PostingsEnum.POSITIONS);
       String currentTerm = termEnum.term().utf8ToString();
 
       assertThat("Token mismatch for field: " + field_name, currentTerm, equalTo(memTermEnum.term().utf8ToString()));

Modified: lucene/dev/trunk/lucene/misc/src/java/org/apache/lucene/index/SortingLeafReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/misc/src/java/org/apache/lucene/index/SortingLeafReader.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/misc/src/java/org/apache/lucene/index/SortingLeafReader.java (original)
+++ lucene/dev/trunk/lucene/misc/src/java/org/apache/lucene/index/SortingLeafReader.java Thu Jun 25 13:59:19 2015
@@ -132,7 +132,7 @@ public class SortingLeafReader extends F
     }
 
     @Override
-    public PostingsEnum postings(Bits liveDocs, PostingsEnum reuse, final int flags) throws IOException {
+    public PostingsEnum postings( PostingsEnum reuse, final int flags) throws IOException {
 
       if (hasPositions && PostingsEnum.featureRequested(flags, PostingsEnum.POSITIONS)) {
         final PostingsEnum inReuse;
@@ -147,7 +147,7 @@ public class SortingLeafReader extends F
           inReuse = reuse;
         }
 
-        final PostingsEnum inDocsAndPositions = in.postings(newToOld(liveDocs), inReuse, flags);
+        final PostingsEnum inDocsAndPositions = in.postings(inReuse, flags);
         // we ignore the fact that offsets may be stored but not asked for,
         // since this code is expected to be used during addIndexes which will
         // ask for everything. if that assumption changes in the future, we can
@@ -168,7 +168,7 @@ public class SortingLeafReader extends F
         inReuse = reuse;
       }
 
-      final PostingsEnum inDocs = in.postings(newToOld(liveDocs), inReuse, flags);
+      final PostingsEnum inDocs = in.postings(inReuse, flags);
       final boolean withFreqs = indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS) >=0 && PostingsEnum.featureRequested(flags, PostingsEnum.FREQS);
       return new SortingDocsEnum(docMap.size(), wrapReuse, inDocs, withFreqs, docMap);
     }

Modified: lucene/dev/trunk/lucene/misc/src/java/org/apache/lucene/uninverting/DocTermOrds.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/misc/src/java/org/apache/lucene/uninverting/DocTermOrds.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/misc/src/java/org/apache/lucene/uninverting/DocTermOrds.java (original)
+++ lucene/dev/trunk/lucene/misc/src/java/org/apache/lucene/uninverting/DocTermOrds.java Thu Jun 25 13:59:19 2015
@@ -346,7 +346,7 @@ public class DocTermOrds implements Acco
       final int df = te.docFreq();
       if (df <= maxTermDocFreq) {
 
-        postingsEnum = te.postings(liveDocs, postingsEnum, PostingsEnum.NONE);
+        postingsEnum = te.postings(postingsEnum, PostingsEnum.NONE);
 
         // dF, but takes deletions into account
         int actualDF = 0;
@@ -593,8 +593,8 @@ public class DocTermOrds implements Acco
     }
 
     @Override    
-    public PostingsEnum postings(Bits liveDocs, PostingsEnum reuse, int flags) throws IOException {
-      return termsEnum.postings(liveDocs, reuse, flags);
+    public PostingsEnum postings(PostingsEnum reuse, int flags) throws IOException {
+      return termsEnum.postings(reuse, flags);
     }
 
     @Override

Modified: lucene/dev/trunk/lucene/misc/src/java/org/apache/lucene/uninverting/FieldCacheImpl.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/misc/src/java/org/apache/lucene/uninverting/FieldCacheImpl.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/misc/src/java/org/apache/lucene/uninverting/FieldCacheImpl.java (original)
+++ lucene/dev/trunk/lucene/misc/src/java/org/apache/lucene/uninverting/FieldCacheImpl.java Thu Jun 25 13:59:19 2015
@@ -288,7 +288,7 @@ class FieldCacheImpl implements FieldCac
             break;
           }
           visitTerm(term);
-          docs = termsEnum.postings(null, docs, PostingsEnum.NONE);
+          docs = termsEnum.postings(docs, PostingsEnum.NONE);
           while (true) {
             final int docID = docs.nextDoc();
             if (docID == DocIdSetIterator.NO_MORE_DOCS) {
@@ -419,7 +419,7 @@ class FieldCacheImpl implements FieldCac
             res = new FixedBitSet(maxDoc);
           }
 
-          docs = termsEnum.postings(null, docs, PostingsEnum.NONE);
+          docs = termsEnum.postings(docs, PostingsEnum.NONE);
           // TODO: use bulk API
           while (true) {
             final int docID = docs.nextDoc();
@@ -698,7 +698,7 @@ class FieldCacheImpl implements FieldCac
           }
 
           termOrdToBytesOffset.add(bytes.copyUsingLengthPrefix(term));
-          docs = termsEnum.postings(null, docs, PostingsEnum.NONE);
+          docs = termsEnum.postings(docs, PostingsEnum.NONE);
           while (true) {
             final int docID = docs.nextDoc();
             if (docID == DocIdSetIterator.NO_MORE_DOCS) {
@@ -850,7 +850,7 @@ class FieldCacheImpl implements FieldCac
             break;
           }
           final long pointer = bytes.copyUsingLengthPrefix(term);
-          docs = termsEnum.postings(null, docs, PostingsEnum.NONE);
+          docs = termsEnum.postings(docs, PostingsEnum.NONE);
           while (true) {
             final int docID = docs.nextDoc();
             if (docID == DocIdSetIterator.NO_MORE_DOCS) {

Modified: lucene/dev/trunk/lucene/misc/src/test/org/apache/lucene/index/SorterTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/misc/src/test/org/apache/lucene/index/SorterTestBase.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/misc/src/test/org/apache/lucene/index/SorterTestBase.java (original)
+++ lucene/dev/trunk/lucene/misc/src/test/org/apache/lucene/index/SorterTestBase.java Thu Jun 25 13:59:19 2015
@@ -235,7 +235,7 @@ public abstract class SorterTestBase ext
   public void testDocsAndPositionsEnum() throws Exception {
     TermsEnum termsEnum = sortedReader.terms(DOC_POSITIONS_FIELD).iterator();
     assertEquals(SeekStatus.FOUND, termsEnum.seekCeil(new BytesRef(DOC_POSITIONS_TERM)));
-    PostingsEnum sortedPositions = termsEnum.postings(null, null, PostingsEnum.ALL);
+    PostingsEnum sortedPositions = termsEnum.postings(null, PostingsEnum.ALL);
     int doc;
     
     // test nextDoc()
@@ -252,7 +252,7 @@ public abstract class SorterTestBase ext
     
     // test advance()
     final PostingsEnum reuse = sortedPositions;
-    sortedPositions = termsEnum.postings(null, reuse, PostingsEnum.ALL);
+    sortedPositions = termsEnum.postings(reuse, PostingsEnum.ALL);
     if (sortedPositions instanceof SortingDocsEnum) {
       assertTrue(((SortingDocsEnum) sortedPositions).reused(reuse)); // make sure reuse worked
     }
@@ -293,40 +293,25 @@ public abstract class SorterTestBase ext
 
   @Test
   public void testDocsEnum() throws Exception {
-    Bits mappedLiveDocs = randomLiveDocs(sortedReader.maxDoc());
     TermsEnum termsEnum = sortedReader.terms(DOCS_ENUM_FIELD).iterator();
     assertEquals(SeekStatus.FOUND, termsEnum.seekCeil(new BytesRef(DOCS_ENUM_TERM)));
-    PostingsEnum docs = termsEnum.postings(mappedLiveDocs, null);
+    PostingsEnum docs = termsEnum.postings(null);
 
     int doc;
     int prev = -1;
     while ((doc = docs.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
-      assertTrue("document " + doc + " marked as deleted", mappedLiveDocs == null || mappedLiveDocs.get(doc));
       assertEquals("incorrect value; doc " + doc, sortedValues[doc].intValue(), Integer.parseInt(sortedReader.document(doc).get(ID_FIELD)));
-      while (++prev < doc) {
-        assertFalse("document " + prev + " not marked as deleted", mappedLiveDocs == null || mappedLiveDocs.get(prev));
-      }
-    }
-    while (++prev < sortedReader.maxDoc()) {
-      assertFalse("document " + prev + " not marked as deleted", mappedLiveDocs == null || mappedLiveDocs.get(prev));
     }
 
     PostingsEnum reuse = docs;
-    docs = termsEnum.postings(mappedLiveDocs, reuse);
+    docs = termsEnum.postings(reuse);
     if (docs instanceof SortingDocsEnum) {
       assertTrue(((SortingDocsEnum) docs).reused(reuse)); // make sure reuse worked
     }
     doc = -1;
     prev = -1;
     while ((doc = docs.advance(doc + 1)) != DocIdSetIterator.NO_MORE_DOCS) {
-      assertTrue("document " + doc + " marked as deleted", mappedLiveDocs == null || mappedLiveDocs.get(doc));
       assertEquals("incorrect value; doc " + doc, sortedValues[doc].intValue(), Integer.parseInt(sortedReader.document(doc).get(ID_FIELD)));
-      while (++prev < doc) {
-        assertFalse("document " + prev + " not marked as deleted", mappedLiveDocs == null || mappedLiveDocs.get(prev));
-      }
-    }
-    while (++prev < sortedReader.maxDoc()) {
-      assertFalse("document " + prev + " not marked as deleted", mappedLiveDocs == null || mappedLiveDocs.get(prev));
     }
   }
   

Modified: lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/BoostingQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/BoostingQuery.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/BoostingQuery.java (original)
+++ lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/BoostingQuery.java Thu Jun 25 13:59:19 2015
@@ -94,12 +94,12 @@ public class BoostingQuery extends Query
         }
 
         @Override
-        public Scorer scorer(LeafReaderContext context, Bits acceptDocs) throws IOException {
-          final Scorer matchScorer = matchWeight.scorer(context, acceptDocs);
+        public Scorer scorer(LeafReaderContext context) throws IOException {
+          final Scorer matchScorer = matchWeight.scorer(context);
           if (matchScorer == null) {
             return null;
           }
-          final Scorer contextScorer = contextWeight.scorer(context, acceptDocs);
+          final Scorer contextScorer = contextWeight.scorer(context);
           if (contextScorer == null) {
             return matchScorer;
           }

Modified: lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/CustomScoreQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/CustomScoreQuery.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/CustomScoreQuery.java (original)
+++ lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/CustomScoreQuery.java Thu Jun 25 13:59:19 2015
@@ -228,14 +228,14 @@ public class CustomScoreQuery extends Qu
     }
 
     @Override
-    public Scorer scorer(LeafReaderContext context, Bits acceptDocs) throws IOException {
-      Scorer subQueryScorer = subQueryWeight.scorer(context, acceptDocs);
+    public Scorer scorer(LeafReaderContext context) throws IOException {
+      Scorer subQueryScorer = subQueryWeight.scorer(context);
       if (subQueryScorer == null) {
         return null;
       }
       Scorer[] valSrcScorers = new Scorer[valSrcWeights.length];
       for(int i = 0; i < valSrcScorers.length; i++) {
-         valSrcScorers[i] = valSrcWeights[i].scorer(context, acceptDocs);
+         valSrcScorers[i] = valSrcWeights[i].scorer(context);
       }
       return new CustomScorer(CustomScoreQuery.this.getCustomScoreProvider(context), this, queryWeight, subQueryScorer, valSrcScorers);
     }

Modified: lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/TermsQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/TermsQuery.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/TermsQuery.java (original)
+++ lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/TermsQuery.java Thu Jun 25 13:59:19 2015
@@ -252,7 +252,7 @@ public class TermsQuery extends Query im
        * On the given leaf context, try to either rewrite to a disjunction if
        * there are few matching terms, or build a bitset containing matching docs.
        */
-      private WeightOrBitSet rewrite(LeafReaderContext context, Bits acceptDocs) throws IOException {
+      private WeightOrBitSet rewrite(LeafReaderContext context) throws IOException {
         final LeafReader reader = context.reader();
 
         // We will first try to collect up to 'threshold' terms into 'matchingTerms'
@@ -282,18 +282,18 @@ public class TermsQuery extends Query im
           }
           if (termsEnum != null && termsEnum.seekExact(term)) {
             if (matchingTerms == null) {
-              docs = termsEnum.postings(acceptDocs, docs, PostingsEnum.NONE);
+              docs = termsEnum.postings(docs, PostingsEnum.NONE);
               builder.or(docs);
             } else if (matchingTerms.size() < threshold) {
               matchingTerms.add(new TermAndState(field, termsEnum));
             } else {
               assert matchingTerms.size() == threshold;
               builder = new BitDocIdSet.Builder(reader.maxDoc());
-              docs = termsEnum.postings(acceptDocs, docs, PostingsEnum.NONE);
+              docs = termsEnum.postings(docs, PostingsEnum.NONE);
               builder.or(docs);
               for (TermAndState t : matchingTerms) {
                 t.termsEnum.seekExact(t.term, t.state);
-                docs = t.termsEnum.postings(acceptDocs, docs, PostingsEnum.NONE);
+                docs = t.termsEnum.postings(docs, PostingsEnum.NONE);
                 builder.or(docs);
               }
               matchingTerms = null;
@@ -329,10 +329,10 @@ public class TermsQuery extends Query im
       }
 
       @Override
-      public BulkScorer bulkScorer(LeafReaderContext context, Bits acceptDocs) throws IOException {
-        final WeightOrBitSet weightOrBitSet = rewrite(context, acceptDocs);
+      public BulkScorer bulkScorer(LeafReaderContext context) throws IOException {
+        final WeightOrBitSet weightOrBitSet = rewrite(context);
         if (weightOrBitSet.weight != null) {
-          return weightOrBitSet.weight.bulkScorer(context, acceptDocs);
+          return weightOrBitSet.weight.bulkScorer(context);
         } else {
           final Scorer scorer = scorer(weightOrBitSet.bitset);
           if (scorer == null) {
@@ -343,10 +343,10 @@ public class TermsQuery extends Query im
       }
 
       @Override
-      public Scorer scorer(LeafReaderContext context, Bits acceptDocs) throws IOException {
-        final WeightOrBitSet weightOrBitSet = rewrite(context, acceptDocs);
+      public Scorer scorer(LeafReaderContext context) throws IOException {
+        final WeightOrBitSet weightOrBitSet = rewrite(context);
         if (weightOrBitSet.weight != null) {
-          return weightOrBitSet.weight.scorer(context, acceptDocs);
+          return weightOrBitSet.weight.scorer(context);
         } else {
           return scorer(weightOrBitSet.bitset);
         }

Modified: lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/function/BoostedQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/function/BoostedQuery.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/function/BoostedQuery.java (original)
+++ lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/function/BoostedQuery.java Thu Jun 25 13:59:19 2015
@@ -98,8 +98,8 @@ public class BoostedQuery extends Query
     }
 
     @Override
-    public Scorer scorer(LeafReaderContext context, Bits acceptDocs) throws IOException {
-      Scorer subQueryScorer = qWeight.scorer(context, acceptDocs);
+    public Scorer scorer(LeafReaderContext context) throws IOException {
+      Scorer subQueryScorer = qWeight.scorer(context);
       if (subQueryScorer == null) {
         return null;
       }

Modified: lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/function/FunctionQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/function/FunctionQuery.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/function/FunctionQuery.java (original)
+++ lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/function/FunctionQuery.java Thu Jun 25 13:59:19 2015
@@ -89,13 +89,13 @@ public class FunctionQuery extends Query
     }
 
     @Override
-    public Scorer scorer(LeafReaderContext context, Bits acceptDocs) throws IOException {
-      return new AllScorer(context, acceptDocs, this, queryWeight);
+    public Scorer scorer(LeafReaderContext context) throws IOException {
+      return new AllScorer(context, this, queryWeight);
     }
 
     @Override
     public Explanation explain(LeafReaderContext context, int doc) throws IOException {
-      return ((AllScorer)scorer(context, context.reader().getLiveDocs())).explain(doc);
+      return ((AllScorer)scorer(context)).explain(doc);
     }
   }
 
@@ -106,15 +106,13 @@ public class FunctionQuery extends Query
     final float qWeight;
     int doc=-1;
     final FunctionValues vals;
-    final Bits acceptDocs;
 
-    public AllScorer(LeafReaderContext context, Bits acceptDocs, FunctionWeight w, float qWeight) throws IOException {
+    public AllScorer(LeafReaderContext context, FunctionWeight w, float qWeight) throws IOException {
       super(w);
       this.weight = w;
       this.qWeight = qWeight;
       this.reader = context.reader();
       this.maxDoc = reader.maxDoc();
-      this.acceptDocs = acceptDocs;
       vals = func.getValues(weight.context, context);
     }
 
@@ -129,21 +127,16 @@ public class FunctionQuery extends Query
     // Boost:        foo:myTerm^floatline("myFloatField",1.0,0.0f)
     @Override
     public int nextDoc() throws IOException {
-      for(;;) {
-        ++doc;
-        if (doc>=maxDoc) {
-          return doc=NO_MORE_DOCS;
-        }
-        if (acceptDocs != null && !acceptDocs.get(doc)) continue;
-        return doc;
+      ++doc;
+      if (doc>=maxDoc) {
+        return doc=NO_MORE_DOCS;
       }
+      return doc;
     }
 
     @Override
     public int advance(int target) throws IOException {
-      // this will work even if target==NO_MORE_DOCS
-      doc=target-1;
-      return nextDoc();
+      return slowAdvance(target);
     }
 
     @Override

Modified: lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/QueryValueSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/QueryValueSource.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/QueryValueSource.java (original)
+++ lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/QueryValueSource.java Thu Jun 25 13:59:19 2015
@@ -80,7 +80,6 @@ public class QueryValueSource extends Va
 
 class QueryDocValues extends FloatDocValues {
   final LeafReaderContext readerContext;
-  final Bits acceptDocs;
   final Weight weight;
   final float defVal;
   final Map fcontext;
@@ -99,7 +98,6 @@ class QueryDocValues extends FloatDocVal
     super(vs);
 
     this.readerContext = readerContext;
-    this.acceptDocs = readerContext.reader().getLiveDocs();
     this.defVal = vs.defVal;
     this.q = vs.q;
     this.fcontext = fcontext;
@@ -126,7 +124,7 @@ class QueryDocValues extends FloatDocVal
     try {
       if (doc < lastDocRequested) {
         if (noMatches) return defVal;
-        scorer = weight.scorer(readerContext, acceptDocs);
+        scorer = weight.scorer(readerContext);
         if (scorer==null) {
           noMatches = true;
           return defVal;
@@ -157,7 +155,7 @@ class QueryDocValues extends FloatDocVal
     try {
       if (doc < lastDocRequested) {
         if (noMatches) return false;
-        scorer = weight.scorer(readerContext, acceptDocs);
+        scorer = weight.scorer(readerContext);
         scorerDoc = -1;
         if (scorer==null) {
           noMatches = true;
@@ -215,7 +213,7 @@ class QueryDocValues extends FloatDocVal
             mval.exists = false;
             return;
           }
-          scorer = weight.scorer(readerContext, acceptDocs);
+          scorer = weight.scorer(readerContext);
           scorerDoc = -1;
           if (scorer==null) {
             noMatches = true;

Modified: lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TFValueSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TFValueSource.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TFValueSource.java (original)
+++ lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TFValueSource.java Thu Jun 25 13:59:19 2015
@@ -72,7 +72,7 @@ public class TFValueSource extends TermF
         if (terms != null) {
           final TermsEnum termsEnum = terms.iterator();
           if (termsEnum.seekExact(indexedBytes)) {
-            docs = termsEnum.postings(null, null);
+            docs = termsEnum.postings(null);
           } else {
             docs = null;
           }

Modified: lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TermFreqValueSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TermFreqValueSource.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TermFreqValueSource.java (original)
+++ lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TermFreqValueSource.java Thu Jun 25 13:59:19 2015
@@ -65,7 +65,7 @@ public class TermFreqValueSource extends
         if (terms != null) {
           final TermsEnum termsEnum = terms.iterator();
           if (termsEnum.seekExact(indexedBytes)) {
-            docs = termsEnum.postings(null, null);
+            docs = termsEnum.postings(null);
           } else {
             docs = null;
           }

Modified: lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/bkdtree/BKDPointInBBoxQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/bkdtree/BKDPointInBBoxQuery.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/bkdtree/BKDPointInBBoxQuery.java (original)
+++ lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/bkdtree/BKDPointInBBoxQuery.java Thu Jun 25 13:59:19 2015
@@ -101,7 +101,7 @@ public class BKDPointInBBoxQuery extends
 
       @Override
       public Explanation explain(LeafReaderContext context, int doc) throws IOException {
-        final Scorer s = scorer(context, context.reader().getLiveDocs());
+        final Scorer s = scorer(context);
         final boolean exists = s != null && s.advance(doc) == doc;
 
         if (exists) {
@@ -113,7 +113,7 @@ public class BKDPointInBBoxQuery extends
       }
 
       @Override
-      public Scorer scorer(LeafReaderContext context, Bits acceptDocs) throws IOException {
+      public Scorer scorer(LeafReaderContext context) throws IOException {
         LeafReader reader = context.reader();
         SortedNumericDocValues sdv = reader.getSortedNumericDocValues(field);
         if (sdv == null) {
@@ -127,7 +127,7 @@ public class BKDPointInBBoxQuery extends
         BKDTreeSortedNumericDocValues treeDV = (BKDTreeSortedNumericDocValues) sdv;
         BKDTreeReader tree = treeDV.getBKDTreeReader();
 
-        DocIdSet result = tree.intersect(acceptDocs, minLat, maxLat, minLon, maxLon, treeDV.delegate);
+        DocIdSet result = tree.intersect(minLat, maxLat, minLon, maxLon, treeDV.delegate);
 
         final DocIdSetIterator disi = result.iterator();
 

Modified: lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/bkdtree/BKDPointInPolygonQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/bkdtree/BKDPointInPolygonQuery.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/bkdtree/BKDPointInPolygonQuery.java (original)
+++ lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/bkdtree/BKDPointInPolygonQuery.java Thu Jun 25 13:59:19 2015
@@ -132,7 +132,7 @@ public class BKDPointInPolygonQuery exte
 
       @Override
       public Explanation explain(LeafReaderContext context, int doc) throws IOException {
-        final Scorer s = scorer(context, context.reader().getLiveDocs());
+        final Scorer s = scorer(context);
         final boolean exists = s != null && s.advance(doc) == doc;
 
         if (exists) {
@@ -144,7 +144,7 @@ public class BKDPointInPolygonQuery exte
       }
 
       @Override
-      public Scorer scorer(LeafReaderContext context, Bits acceptDocs) throws IOException {
+      public Scorer scorer(LeafReaderContext context) throws IOException {
         LeafReader reader = context.reader();
         SortedNumericDocValues sdv = reader.getSortedNumericDocValues(field);
         if (sdv == null) {
@@ -160,7 +160,7 @@ public class BKDPointInPolygonQuery exte
         
         // TODO: make this more efficient: as we recurse the BKD tree we should check whether the
         // bbox we are recursing into intersects our shape; Apache SIS may have (non-GPL!) code to do this?
-        DocIdSet result = tree.intersect(acceptDocs, minLat, maxLat, minLon, maxLon,
+        DocIdSet result = tree.intersect(minLat, maxLat, minLon, maxLon,
                                          new BKDTreeReader.LatLonFilter() {
                                            @Override
                                            public boolean accept(double lat, double lon) {

Modified: lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/bkdtree/BKDTreeReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/bkdtree/BKDTreeReader.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/bkdtree/BKDTreeReader.java (original)
+++ lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/bkdtree/BKDTreeReader.java Thu Jun 25 13:59:19 2015
@@ -95,11 +95,11 @@ final class BKDTreeReader implements Acc
     }
   }
 
-  public DocIdSet intersect(Bits acceptDocs, double latMin, double latMax, double lonMin, double lonMax, SortedNumericDocValues sndv) throws IOException {
-    return intersect(acceptDocs, latMin, latMax, lonMin, lonMax, null, sndv);
+  public DocIdSet intersect(double latMin, double latMax, double lonMin, double lonMax, SortedNumericDocValues sndv) throws IOException {
+    return intersect(latMin, latMax, lonMin, lonMax, null, sndv);
   }
 
-  public DocIdSet intersect(Bits acceptDocs, double latMin, double latMax, double lonMin, double lonMax, LatLonFilter filter, SortedNumericDocValues sndv) throws IOException {
+  public DocIdSet intersect(double latMin, double latMax, double lonMin, double lonMax, LatLonFilter filter, SortedNumericDocValues sndv) throws IOException {
     if (BKDTreeWriter.validLat(latMin) == false) {
       throw new IllegalArgumentException("invalid latMin: " + latMin);
     }
@@ -128,7 +128,7 @@ final class BKDTreeReader implements Acc
                                       filter,
                                       sndv);
 
-    int hitCount = intersect(acceptDocs, state, 1,
+    int hitCount = intersect(state, 1,
                              BKDTreeWriter.encodeLat(-90.0),
                              BKDTreeWriter.encodeLat(Math.nextAfter(90.0, Double.POSITIVE_INFINITY)),
                              BKDTreeWriter.encodeLon(-180.0),
@@ -139,7 +139,7 @@ final class BKDTreeReader implements Acc
   }
 
   /** Fast path: this is called when the query rect fully encompasses all cells under this node. */
-  private int addAll(Bits acceptDocs, QueryState state, int nodeID) throws IOException {
+  private int addAll(QueryState state, int nodeID) throws IOException {
 
     //long latRange = (long) cellLatMaxEnc - (long) cellLatMinEnc;
     //long lonRange = (long) cellLonMaxEnc - (long) cellLonMinEnc;
@@ -167,18 +167,9 @@ final class BKDTreeReader implements Acc
       //System.out.println("    seek to leafFP=" + fp);
       // How many points are stored in this leaf cell:
       int count = state.in.readVInt();
-      if (acceptDocs != null) {
-        for(int i=0;i<count;i++) {
-          int docID = state.in.readInt();
-          if (acceptDocs.get(docID)) {
-            state.bits.set(docID);
-          }
-        }
-      } else {
-        for(int i=0;i<count;i++) {
-          int docID = state.in.readInt();
-          state.bits.set(docID);
-        }
+      for(int i=0;i<count;i++) {
+        int docID = state.in.readInt();
+        state.bits.set(docID);
       }
 
       //bits.or(allLeafDISI);
@@ -195,14 +186,14 @@ final class BKDTreeReader implements Acc
       //System.out.println("  splitValue=" + splitValue);
 
       //System.out.println("  addAll: inner");
-      int count = addAll(acceptDocs, state, 2*nodeID);
-      count += addAll(acceptDocs, state, 2*nodeID+1);
+      int count = addAll(state, 2*nodeID);
+      count += addAll(state, 2*nodeID+1);
       //System.out.println("  addAll: return count=" + count);
       return count;
     }
   }
 
-  private int intersect(Bits acceptDocs, QueryState state,
+  private int intersect(QueryState state,
                         int nodeID,
                         int cellLatMinEnc, int cellLatMaxEnc, int cellLonMinEnc, int cellLonMaxEnc)
     throws IOException {
@@ -223,7 +214,7 @@ final class BKDTreeReader implements Acc
           return 0;
         } else if (r == Relation.INSIDE) {
           // This cell is fully inside of the query shape: recursively add all points in this cell without filtering
-          return addAll(acceptDocs, state, nodeID);
+          return addAll(state, nodeID);
         } else {
           // The cell crosses the shape boundary, so we fall through and do full filtering
         }
@@ -231,7 +222,7 @@ final class BKDTreeReader implements Acc
     } else if (state.latMinEnc <= cellLatMinEnc && state.latMaxEnc >= cellLatMaxEnc && state.lonMinEnc <= cellLonMinEnc && state.lonMaxEnc >= cellLonMaxEnc) {
       // Optimize the case when the query fully contains this cell: we can
       // recursively add all points without checking if they match the query:
-      return addAll(acceptDocs, state, nodeID);
+      return addAll(state, nodeID);
     }
 
     long latRange = (long) cellLatMaxEnc - (long) cellLatMinEnc;
@@ -273,28 +264,26 @@ final class BKDTreeReader implements Acc
 
       for(int i=0;i<count;i++) {
         int docID = state.in.readInt();
-        if (acceptDocs == null || acceptDocs.get(docID)) {
-          state.sndv.setDocument(docID);
-          // How many values this doc has:
-          int docValueCount = state.sndv.count();
-          for(int j=0;j<docValueCount;j++) {
-            long enc = state.sndv.valueAt(j);
-
-            int latEnc = (int) ((enc>>32) & 0xffffffffL);
-            int lonEnc = (int) (enc & 0xffffffffL);
-
-            if (latEnc >= state.latMinEnc &&
-                latEnc < state.latMaxEnc &&
-                lonEnc >= state.lonMinEnc &&
-                lonEnc < state.lonMaxEnc &&
-                (state.latLonFilter == null ||
-                 state.latLonFilter.accept(BKDTreeWriter.decodeLat(latEnc), BKDTreeWriter.decodeLon(lonEnc)))) {
-              state.bits.set(docID);
-              hitCount++;
-
-              // Stop processing values for this doc:
-              break;
-            }
+        state.sndv.setDocument(docID);
+        // How many values this doc has:
+        int docValueCount = state.sndv.count();
+        for(int j=0;j<docValueCount;j++) {
+          long enc = state.sndv.valueAt(j);
+
+          int latEnc = (int) ((enc>>32) & 0xffffffffL);
+          int lonEnc = (int) (enc & 0xffffffffL);
+
+          if (latEnc >= state.latMinEnc &&
+              latEnc < state.latMaxEnc &&
+              lonEnc >= state.lonMinEnc &&
+              lonEnc < state.lonMaxEnc &&
+              (state.latLonFilter == null ||
+               state.latLonFilter.accept(BKDTreeWriter.decodeLat(latEnc), BKDTreeWriter.decodeLon(lonEnc)))) {
+            state.bits.set(docID);
+            hitCount++;
+
+            // Stop processing values for this doc:
+            break;
           }
         }
       }
@@ -330,7 +319,7 @@ final class BKDTreeReader implements Acc
         // Left node:
         if (state.latMinEnc < splitValue) {
           //System.out.println("  recurse left");
-          count += intersect(acceptDocs, state,
+          count += intersect(state,
                              2*nodeID,
                              cellLatMinEnc, splitValue, cellLonMinEnc, cellLonMaxEnc);
         }
@@ -338,7 +327,7 @@ final class BKDTreeReader implements Acc
         // Right node:
         if (state.latMaxEnc >= splitValue) {
           //System.out.println("  recurse right");
-          count += intersect(acceptDocs, state,
+          count += intersect(state,
                              2*nodeID+1,
                              splitValue, cellLatMaxEnc, cellLonMinEnc, cellLonMaxEnc);
         }
@@ -352,7 +341,7 @@ final class BKDTreeReader implements Acc
         // Left node:
         if (state.lonMinEnc < splitValue) {
           // System.out.println("  recurse left");
-          count += intersect(acceptDocs, state,
+          count += intersect(state,
                              2*nodeID,
                              cellLatMinEnc, cellLatMaxEnc, cellLonMinEnc, splitValue);
         }
@@ -360,7 +349,7 @@ final class BKDTreeReader implements Acc
         // Right node:
         if (state.lonMaxEnc >= splitValue) {
           // System.out.println("  recurse right");
-          count += intersect(acceptDocs, state,
+          count += intersect(state,
                              2*nodeID+1,
                              cellLatMinEnc, cellLatMaxEnc, splitValue, cellLonMaxEnc);
         }

Modified: lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionPostingsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionPostingsReader.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionPostingsReader.java (original)
+++ lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionPostingsReader.java Thu Jun 25 13:59:19 2015
@@ -63,7 +63,7 @@ final class IDVersionPostingsReader exte
   }
 
   @Override
-  public PostingsEnum postings(FieldInfo fieldInfo, BlockTermState termState, Bits liveDocs, PostingsEnum reuse, int flags) throws IOException {
+  public PostingsEnum postings(FieldInfo fieldInfo, BlockTermState termState, PostingsEnum reuse, int flags) throws IOException {
     SingleDocsEnum docsEnum;
 
     if (PostingsEnum.featureRequested(flags, PostingsEnum.POSITIONS)) {
@@ -75,7 +75,7 @@ final class IDVersionPostingsReader exte
         posEnum = new SinglePostingsEnum();
       }
       IDVersionTermState _termState = (IDVersionTermState) termState;
-      posEnum.reset(_termState.docID, _termState.idVersion, liveDocs);
+      posEnum.reset(_termState.docID, _termState.idVersion);
       return posEnum;
     }
 
@@ -84,7 +84,7 @@ final class IDVersionPostingsReader exte
     } else {
       docsEnum = new SingleDocsEnum();
     }
-    docsEnum.reset(((IDVersionTermState) termState).docID, liveDocs);
+    docsEnum.reset(((IDVersionTermState) termState).docID);
 
     return docsEnum;
   }

Modified: lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionSegmentTermsEnum.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionSegmentTermsEnum.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionSegmentTermsEnum.java (original)
+++ lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionSegmentTermsEnum.java Thu Jun 25 13:59:19 2015
@@ -995,7 +995,7 @@ public final class IDVersionSegmentTerms
   }
 
   @Override
-  public PostingsEnum postings(Bits skipDocs, PostingsEnum reuse, int flags) throws IOException {
+  public PostingsEnum postings(PostingsEnum reuse, int flags) throws IOException {
     assert !eof;
     //if (DEBUG) {
     //System.out.println("BTTR.docs seg=" + segment);
@@ -1004,7 +1004,7 @@ public final class IDVersionSegmentTerms
     //if (DEBUG) {
     //System.out.println("  state=" + currentFrame.state);
     //}
-    return fr.parent.postingsReader.postings(fr.fieldInfo, currentFrame.state, skipDocs, reuse, flags);
+    return fr.parent.postingsReader.postings(fr.fieldInfo, currentFrame.state, reuse, flags);
   }
 
   @Override

Modified: lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/SingleDocsEnum.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/SingleDocsEnum.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/SingleDocsEnum.java (original)
+++ lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/SingleDocsEnum.java Thu Jun 25 13:59:19 2015
@@ -20,25 +20,22 @@ package org.apache.lucene.codecs.idversi
 import java.io.IOException;
 
 import org.apache.lucene.index.PostingsEnum;
-import org.apache.lucene.util.Bits;
 import org.apache.lucene.util.BytesRef;
 
 class SingleDocsEnum extends PostingsEnum {
 
   private int doc;
   private int singleDocID;
-  private Bits liveDocs;
 
   /** For reuse */
-  public void reset(int singleDocID, Bits liveDocs) {
+  public void reset(int singleDocID) {
     doc = -1;
-    this.liveDocs = liveDocs;
     this.singleDocID = singleDocID;
   }
 
   @Override
   public int nextDoc() {
-    if (doc == -1 && (liveDocs == null || liveDocs.get(singleDocID))) {
+    if (doc == -1) {
       doc = singleDocID;
     } else {
       doc = NO_MORE_DOCS;
@@ -54,7 +51,7 @@ class SingleDocsEnum extends PostingsEnu
 
   @Override
   public int advance(int target) {
-    if (doc == -1 && target <= singleDocID && (liveDocs == null || liveDocs.get(singleDocID))) {
+    if (doc == -1 && target <= singleDocID) {
       doc = singleDocID;
     } else {
       doc = NO_MORE_DOCS;

Modified: lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/SinglePostingsEnum.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/SinglePostingsEnum.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/SinglePostingsEnum.java (original)
+++ lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/SinglePostingsEnum.java Thu Jun 25 13:59:19 2015
@@ -18,14 +18,12 @@ package org.apache.lucene.codecs.idversi
  */
 
 import org.apache.lucene.index.PostingsEnum;
-import org.apache.lucene.util.Bits;
 import org.apache.lucene.util.BytesRef;
 
 class SinglePostingsEnum extends PostingsEnum {
   private int doc;
   private int pos;
   private int singleDocID;
-  private Bits liveDocs;
   private long version;
   private final BytesRef payload;
 
@@ -35,16 +33,15 @@ class SinglePostingsEnum extends Posting
   }
 
   /** For reuse */
-  public void reset(int singleDocID, long version, Bits liveDocs) {
+  public void reset(int singleDocID, long version) {
     doc = -1;
-    this.liveDocs = liveDocs;
     this.singleDocID = singleDocID;
     this.version = version;
   }
 
   @Override
   public int nextDoc() {
-    if (doc == -1 && (liveDocs == null || liveDocs.get(singleDocID))) {
+    if (doc == -1) {
       doc = singleDocID;
     } else {
       doc = NO_MORE_DOCS;
@@ -61,7 +58,7 @@ class SinglePostingsEnum extends Posting
 
   @Override
   public int advance(int target) {
-    if (doc == -1 && target <= singleDocID && (liveDocs == null || liveDocs.get(singleDocID))) {
+    if (doc == -1 && target <= singleDocID) {
       doc = singleDocID;
       pos = -1;
     } else {

Modified: lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/sandbox/queries/DuplicateFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/sandbox/queries/DuplicateFilter.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/sandbox/queries/DuplicateFilter.java (original)
+++ lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/sandbox/queries/DuplicateFilter.java Thu Jun 25 13:59:19 2015
@@ -24,6 +24,7 @@ import org.apache.lucene.index.LeafReade
 import org.apache.lucene.index.SlowCompositeReaderWrapper;
 import org.apache.lucene.index.Terms;
 import org.apache.lucene.index.TermsEnum;
+import org.apache.lucene.search.BitsFilteredDocIdSet;
 import org.apache.lucene.search.DocIdSet;
 import org.apache.lucene.search.DocIdSetIterator;
 import org.apache.lucene.search.Filter;
@@ -106,7 +107,7 @@ public class DuplicateFilter extends Fil
         if (currTerm == null) {
           break;
         } else {
-          docs = termsEnum.postings(acceptDocs, docs, PostingsEnum.NONE);
+          docs = termsEnum.postings(docs, PostingsEnum.NONE);
           int doc = docs.nextDoc();
           if (doc != DocIdSetIterator.NO_MORE_DOCS) {
             if (keepMode == KeepMode.KM_USE_FIRST_OCCURRENCE) {
@@ -126,7 +127,7 @@ public class DuplicateFilter extends Fil
         }
       }
     }
-    return new BitDocIdSet(bits, bits.approximateCardinality());
+    return BitsFilteredDocIdSet.wrap(new BitDocIdSet(bits, bits.approximateCardinality()), acceptDocs);
   }
 
   private DocIdSet fastBits(LeafReader reader, Bits acceptDocs) throws IOException {
@@ -144,7 +145,7 @@ public class DuplicateFilter extends Fil
         } else {
           if (termsEnum.docFreq() > 1) {
             // unset potential duplicates
-            docs = termsEnum.postings(acceptDocs, docs, PostingsEnum.NONE);
+            docs = termsEnum.postings(docs, PostingsEnum.NONE);
             int doc = docs.nextDoc();
             if (doc != DocIdSetIterator.NO_MORE_DOCS) {
               if (keepMode == KeepMode.KM_USE_FIRST_OCCURRENCE) {
@@ -171,7 +172,7 @@ public class DuplicateFilter extends Fil
       }
     }
 
-    return new BitDocIdSet(bits);
+    return BitsFilteredDocIdSet.wrap(new BitDocIdSet(bits), acceptDocs);
   }
 
   public String getFieldName() {

Modified: lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/search/TermAutomatonQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/search/TermAutomatonQuery.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/search/TermAutomatonQuery.java (original)
+++ lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/search/TermAutomatonQuery.java Thu Jun 25 13:59:19 2015
@@ -381,7 +381,7 @@ public class TermAutomatonQuery extends
     }
 
     @Override
-    public Scorer scorer(LeafReaderContext context, Bits acceptDocs) throws IOException {
+    public Scorer scorer(LeafReaderContext context) throws IOException {
 
       // Initialize the enums; null for a given slot means that term didn't appear in this reader
       EnumAndScorer[] enums = new EnumAndScorer[idToTerm.size()];
@@ -395,7 +395,7 @@ public class TermAutomatonQuery extends
 
           TermsEnum termsEnum = context.reader().terms(field).iterator();
           termsEnum.seekExact(term, state);
-          enums[ent.getKey()] = new EnumAndScorer(ent.getKey(), termsEnum.postings(acceptDocs, null, PostingsEnum.POSITIONS));
+          enums[ent.getKey()] = new EnumAndScorer(ent.getKey(), termsEnum.postings(null, PostingsEnum.POSITIONS));
         }
       }
 

Modified: lucene/dev/trunk/lucene/sandbox/src/test/org/apache/lucene/codecs/idversion/TestIDVersionPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/sandbox/src/test/org/apache/lucene/codecs/idversion/TestIDVersionPostingsFormat.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/sandbox/src/test/org/apache/lucene/codecs/idversion/TestIDVersionPostingsFormat.java (original)
+++ lucene/dev/trunk/lucene/sandbox/src/test/org/apache/lucene/codecs/idversion/TestIDVersionPostingsFormat.java Thu Jun 25 13:59:19 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/trunk/lucene/sandbox/src/test/org/apache/lucene/sandbox/queries/DuplicateFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/sandbox/src/test/org/apache/lucene/sandbox/queries/DuplicateFilterTest.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/sandbox/src/test/org/apache/lucene/sandbox/queries/DuplicateFilterTest.java (original)
+++ lucene/dev/trunk/lucene/sandbox/src/test/org/apache/lucene/sandbox/queries/DuplicateFilterTest.java Thu Jun 25 13:59:19 2015
@@ -155,7 +155,6 @@ public class DuplicateFilterTest extends
       PostingsEnum td = TestUtil.docs(random(), reader,
           KEY_FIELD,
           new BytesRef(url),
-          MultiFields.getLiveDocs(reader),
           null,
           0);
 
@@ -183,7 +182,6 @@ public class DuplicateFilterTest extends
       PostingsEnum td = TestUtil.docs(random(), reader,
           KEY_FIELD,
           new BytesRef(url),
-          MultiFields.getLiveDocs(reader),
           null,
           0);
 

Modified: lucene/dev/trunk/lucene/sandbox/src/test/org/apache/lucene/search/TestDocValuesRangeQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/sandbox/src/test/org/apache/lucene/search/TestDocValuesRangeQuery.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/sandbox/src/test/org/apache/lucene/search/TestDocValuesRangeQuery.java (original)
+++ lucene/dev/trunk/lucene/sandbox/src/test/org/apache/lucene/search/TestDocValuesRangeQuery.java Thu Jun 25 13:59:19 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/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/composite/CompositeVerifyQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/composite/CompositeVerifyQuery.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/composite/CompositeVerifyQuery.java (original)
+++ lucene/dev/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/composite/CompositeVerifyQuery.java Thu Jun 25 13:59:19 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/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/composite/IntersectsRPTVerifyQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/composite/IntersectsRPTVerifyQuery.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/composite/IntersectsRPTVerifyQuery.java (original)
+++ lucene/dev/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/composite/IntersectsRPTVerifyQuery.java Thu Jun 25 13:59:19 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/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/AbstractPrefixTreeFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/AbstractPrefixTreeFilter.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/AbstractPrefixTreeFilter.java (original)
+++ lucene/dev/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/AbstractPrefixTreeFilter.java Thu Jun 25 13:59:19 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/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/ContainsPrefixTreeFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/ContainsPrefixTreeFilter.java?rev=1687524&r1=1687523&r2=1687524&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/ContainsPrefixTreeFilter.java (original)
+++ lucene/dev/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/ContainsPrefixTreeFilter.java Thu Jun 25 13:59:19 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)



Mime
View raw message