mirror of https://github.com/apache/lucene.git
LUCENE-6291: Rename TwoPhaseDocIdSetIterator to TwoPhaseIterator.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1662414 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3ec9440e94
commit
ed358ad9ad
|
@ -86,7 +86,7 @@ Optimizations
|
|||
* LUCENE-6233 Speed up CheckIndex when the index has term vectors
|
||||
(Robert Muir, Mike McCandless)
|
||||
|
||||
* LUCENE-6198: Added the TwoPhaseDocIdSetIterator API, exposed on scorers which
|
||||
* LUCENE-6198: Added the TwoPhaseIterator API, exposed on scorers which
|
||||
is for now only used on phrase queries and conjunctions in order to check
|
||||
positions lazily if the phrase query is in a conjunction with other queries.
|
||||
(Robert Muir, Adrien Grand)
|
||||
|
|
|
@ -39,7 +39,7 @@ class BooleanTopLevelScorers {
|
|||
}
|
||||
|
||||
@Override
|
||||
public TwoPhaseDocIdSetIterator asTwoPhaseIterator() {
|
||||
public TwoPhaseIterator asTwoPhaseIterator() {
|
||||
return in.asTwoPhaseIterator();
|
||||
}
|
||||
|
||||
|
|
|
@ -27,14 +27,14 @@ import org.apache.lucene.util.CollectionUtil;
|
|||
class ConjunctionDISI extends DocIdSetIterator {
|
||||
|
||||
/** Create a conjunction over the provided iterators, taking advantage of
|
||||
* {@link TwoPhaseDocIdSetIterator}. */
|
||||
* {@link TwoPhaseIterator}. */
|
||||
public static ConjunctionDISI intersect(List<? extends DocIdSetIterator> iterators) {
|
||||
final List<DocIdSetIterator> allIterators = new ArrayList<>();
|
||||
final List<TwoPhaseDocIdSetIterator> twoPhaseIterators = new ArrayList<>();
|
||||
final List<TwoPhaseIterator> twoPhaseIterators = new ArrayList<>();
|
||||
for (DocIdSetIterator iterator : iterators) {
|
||||
if (iterator instanceof Scorer) {
|
||||
// if we have a scorer, check if it supports two-phase iteration
|
||||
TwoPhaseDocIdSetIterator twoPhaseIterator = ((Scorer) iterator).asTwoPhaseIterator();
|
||||
TwoPhaseIterator twoPhaseIterator = ((Scorer) iterator).asTwoPhaseIterator();
|
||||
if (twoPhaseIterator != null) {
|
||||
// Note:
|
||||
allIterators.add(twoPhaseIterator.approximation());
|
||||
|
@ -75,7 +75,7 @@ class ConjunctionDISI extends DocIdSetIterator {
|
|||
return true;
|
||||
}
|
||||
|
||||
TwoPhaseDocIdSetIterator asTwoPhaseIterator() {
|
||||
TwoPhaseIterator asTwoPhaseIterator() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -136,17 +136,17 @@ class ConjunctionDISI extends DocIdSetIterator {
|
|||
}
|
||||
|
||||
/**
|
||||
* {@link TwoPhaseDocIdSetIterator} view of a {@link TwoPhase} conjunction.
|
||||
* {@link TwoPhaseIterator} view of a {@link TwoPhase} conjunction.
|
||||
*/
|
||||
private static class TwoPhaseConjunctionDISI extends TwoPhaseDocIdSetIterator {
|
||||
private static class TwoPhaseConjunctionDISI extends TwoPhaseIterator {
|
||||
|
||||
private final ConjunctionDISI approximation;
|
||||
private final TwoPhaseDocIdSetIterator[] twoPhaseIterators;
|
||||
private final TwoPhaseIterator[] twoPhaseIterators;
|
||||
|
||||
private TwoPhaseConjunctionDISI(List<? extends DocIdSetIterator> iterators, List<TwoPhaseDocIdSetIterator> twoPhaseIterators) {
|
||||
private TwoPhaseConjunctionDISI(List<? extends DocIdSetIterator> iterators, List<TwoPhaseIterator> twoPhaseIterators) {
|
||||
approximation = new ConjunctionDISI(iterators);
|
||||
assert twoPhaseIterators.size() > 0;
|
||||
this.twoPhaseIterators = twoPhaseIterators.toArray(new TwoPhaseDocIdSetIterator[0]);
|
||||
this.twoPhaseIterators = twoPhaseIterators.toArray(new TwoPhaseIterator[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -156,7 +156,7 @@ class ConjunctionDISI extends DocIdSetIterator {
|
|||
|
||||
@Override
|
||||
public boolean matches() throws IOException {
|
||||
for (TwoPhaseDocIdSetIterator twoPhaseIterator : twoPhaseIterators) {
|
||||
for (TwoPhaseIterator twoPhaseIterator : twoPhaseIterators) {
|
||||
if (twoPhaseIterator.matches() == false) {
|
||||
return false;
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ class ConjunctionDISI extends DocIdSetIterator {
|
|||
/**
|
||||
* A conjunction DISI built on top of approximations. This implementation
|
||||
* verifies that documents actually match by consulting the provided
|
||||
* {@link TwoPhaseDocIdSetIterator}s.
|
||||
* {@link TwoPhaseIterator}s.
|
||||
*
|
||||
* Another important difference with {@link ConjunctionDISI} is that this
|
||||
* implementation supports approximations too: the approximation of this
|
||||
|
@ -183,7 +183,7 @@ class ConjunctionDISI extends DocIdSetIterator {
|
|||
|
||||
final TwoPhaseConjunctionDISI twoPhaseView;
|
||||
|
||||
private TwoPhase(List<? extends DocIdSetIterator> iterators, List<TwoPhaseDocIdSetIterator> twoPhaseIterators) {
|
||||
private TwoPhase(List<? extends DocIdSetIterator> iterators, List<TwoPhaseIterator> twoPhaseIterators) {
|
||||
super(iterators);
|
||||
twoPhaseView = new TwoPhaseConjunctionDISI(iterators, twoPhaseIterators);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ class ConjunctionScorer extends Scorer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public TwoPhaseDocIdSetIterator asTwoPhaseIterator() {
|
||||
public TwoPhaseIterator asTwoPhaseIterator() {
|
||||
return disi.asTwoPhaseIterator();
|
||||
}
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ public class ConstantScoreQuery extends Query {
|
|||
}
|
||||
|
||||
@Override
|
||||
public TwoPhaseDocIdSetIterator asTwoPhaseIterator() {
|
||||
public TwoPhaseIterator asTwoPhaseIterator() {
|
||||
return in.asTwoPhaseIterator();
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ abstract class DisjunctionScorer extends Scorer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public TwoPhaseDocIdSetIterator asTwoPhaseIterator() {
|
||||
public TwoPhaseIterator asTwoPhaseIterator() {
|
||||
boolean hasApproximation = false;
|
||||
for (ScorerWrapper w : subScorers) {
|
||||
if (w.twoPhaseView != null) {
|
||||
|
@ -119,7 +119,7 @@ abstract class DisjunctionScorer extends Scorer {
|
|||
return null;
|
||||
}
|
||||
|
||||
return new TwoPhaseDocIdSetIterator() {
|
||||
return new TwoPhaseIterator() {
|
||||
|
||||
@Override
|
||||
public DocIdSetIterator approximation() {
|
||||
|
|
|
@ -134,7 +134,7 @@ public final class DocValuesRangeQuery extends Query {
|
|||
}
|
||||
|
||||
final DocIdSetIterator approximation = DocIdSetIterator.all(context.reader().maxDoc());
|
||||
final TwoPhaseDocIdSetIterator twoPhaseRange;
|
||||
final TwoPhaseIterator twoPhaseRange;
|
||||
if (lowerVal instanceof Long || upperVal instanceof Long) {
|
||||
|
||||
final SortedNumericDocValues values = DocValues.getSortedNumeric(context.reader(), field);
|
||||
|
@ -211,7 +211,7 @@ public final class DocValuesRangeQuery extends Query {
|
|||
};
|
||||
}
|
||||
|
||||
private static class TwoPhaseNumericRange extends TwoPhaseDocIdSetIterator {
|
||||
private static class TwoPhaseNumericRange extends TwoPhaseIterator {
|
||||
|
||||
private final DocIdSetIterator approximation;
|
||||
private final SortedNumericDocValues values;
|
||||
|
@ -249,7 +249,7 @@ public final class DocValuesRangeQuery extends Query {
|
|||
|
||||
}
|
||||
|
||||
private static class TwoPhaseOrdRange extends TwoPhaseDocIdSetIterator {
|
||||
private static class TwoPhaseOrdRange extends TwoPhaseIterator {
|
||||
|
||||
private final DocIdSetIterator approximation;
|
||||
private final SortedSetDocValues values;
|
||||
|
@ -287,19 +287,19 @@ public final class DocValuesRangeQuery extends Query {
|
|||
|
||||
private static class RangeScorer extends Scorer {
|
||||
|
||||
private final TwoPhaseDocIdSetIterator twoPhaseRange;
|
||||
private final TwoPhaseIterator twoPhaseRange;
|
||||
private final DocIdSetIterator disi;
|
||||
private final float score;
|
||||
|
||||
RangeScorer(Weight weight, TwoPhaseDocIdSetIterator twoPhaseRange, float score) {
|
||||
RangeScorer(Weight weight, TwoPhaseIterator twoPhaseRange, float score) {
|
||||
super(weight);
|
||||
this.twoPhaseRange = twoPhaseRange;
|
||||
this.disi = TwoPhaseDocIdSetIterator.asDocIdSetIterator(twoPhaseRange);
|
||||
this.disi = TwoPhaseIterator.asDocIdSetIterator(twoPhaseRange);
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TwoPhaseDocIdSetIterator asTwoPhaseIterator() {
|
||||
public TwoPhaseIterator asTwoPhaseIterator() {
|
||||
return twoPhaseRange;
|
||||
}
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ public class DocValuesTermsQuery extends Query {
|
|||
}
|
||||
|
||||
final DocIdSetIterator approximation = DocIdSetIterator.all(context.reader().maxDoc());
|
||||
final TwoPhaseDocIdSetIterator twoPhaseIterator = new TwoPhaseDocIdSetIterator() {
|
||||
final TwoPhaseIterator twoPhaseIterator = new TwoPhaseIterator() {
|
||||
@Override
|
||||
public DocIdSetIterator approximation() {
|
||||
return approximation;
|
||||
|
@ -180,11 +180,11 @@ public class DocValuesTermsQuery extends Query {
|
|||
return false;
|
||||
}
|
||||
};
|
||||
final DocIdSetIterator disi = TwoPhaseDocIdSetIterator.asDocIdSetIterator(twoPhaseIterator);
|
||||
final DocIdSetIterator disi = TwoPhaseIterator.asDocIdSetIterator(twoPhaseIterator);
|
||||
return new Scorer(this) {
|
||||
|
||||
@Override
|
||||
public TwoPhaseDocIdSetIterator asTwoPhaseIterator() {
|
||||
public TwoPhaseIterator asTwoPhaseIterator() {
|
||||
return twoPhaseIterator;
|
||||
}
|
||||
|
||||
|
|
|
@ -62,8 +62,8 @@ final class ExactPhraseScorer extends Scorer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public TwoPhaseDocIdSetIterator asTwoPhaseIterator() {
|
||||
return new TwoPhaseDocIdSetIterator() {
|
||||
public TwoPhaseIterator asTwoPhaseIterator() {
|
||||
return new TwoPhaseIterator() {
|
||||
|
||||
@Override
|
||||
public boolean matches() throws IOException {
|
||||
|
|
|
@ -71,7 +71,7 @@ public final class FieldValueQuery extends Query {
|
|||
}
|
||||
|
||||
final DocIdSetIterator approximation = DocIdSetIterator.all(context.reader().maxDoc());
|
||||
final TwoPhaseDocIdSetIterator twoPhaseIterator = new TwoPhaseDocIdSetIterator() {
|
||||
final TwoPhaseIterator twoPhaseIterator = new TwoPhaseIterator() {
|
||||
|
||||
@Override
|
||||
public boolean matches() throws IOException {
|
||||
|
@ -90,12 +90,12 @@ public final class FieldValueQuery extends Query {
|
|||
return approximation;
|
||||
}
|
||||
};
|
||||
final DocIdSetIterator disi = TwoPhaseDocIdSetIterator.asDocIdSetIterator(twoPhaseIterator);
|
||||
final DocIdSetIterator disi = TwoPhaseIterator.asDocIdSetIterator(twoPhaseIterator);
|
||||
|
||||
return new Scorer(this) {
|
||||
|
||||
@Override
|
||||
public TwoPhaseDocIdSetIterator asTwoPhaseIterator() {
|
||||
public TwoPhaseIterator asTwoPhaseIterator() {
|
||||
return twoPhaseIterator;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,8 +34,8 @@ class ReqExclScorer extends FilterScorer {
|
|||
private final DocIdSetIterator reqApproximation;
|
||||
private final DocIdSetIterator exclApproximation;
|
||||
// two-phase views of the scorers, or null if they do not support approximations
|
||||
private final TwoPhaseDocIdSetIterator reqTwoPhaseIterator;
|
||||
private final TwoPhaseDocIdSetIterator exclTwoPhaseIterator;
|
||||
private final TwoPhaseIterator reqTwoPhaseIterator;
|
||||
private final TwoPhaseIterator exclTwoPhaseIterator;
|
||||
|
||||
/** Construct a <code>ReqExclScorer</code>.
|
||||
* @param reqScorer The scorer that must match, except where
|
||||
|
@ -63,9 +63,9 @@ class ReqExclScorer extends FilterScorer {
|
|||
return toNonExcluded(reqApproximation.nextDoc());
|
||||
}
|
||||
|
||||
/** Confirms whether or not the given {@link TwoPhaseDocIdSetIterator}
|
||||
/** Confirms whether or not the given {@link TwoPhaseIterator}
|
||||
* matches on the current document. */
|
||||
private static boolean matches(TwoPhaseDocIdSetIterator it) throws IOException {
|
||||
private static boolean matches(TwoPhaseIterator it) throws IOException {
|
||||
return it == null || it.matches();
|
||||
}
|
||||
|
||||
|
@ -76,8 +76,8 @@ class ReqExclScorer extends FilterScorer {
|
|||
* - it does NOT call matches() on req if the excl approximation is exact
|
||||
* and is on the same doc ID as the req approximation */
|
||||
private static boolean matches(int doc, int exclDoc,
|
||||
TwoPhaseDocIdSetIterator reqTwoPhaseIterator,
|
||||
TwoPhaseDocIdSetIterator exclTwoPhaseIterator) throws IOException {
|
||||
TwoPhaseIterator reqTwoPhaseIterator,
|
||||
TwoPhaseIterator exclTwoPhaseIterator) throws IOException {
|
||||
assert exclDoc >= doc;
|
||||
if (doc == exclDoc && matches(exclTwoPhaseIterator)) {
|
||||
return false;
|
||||
|
@ -126,11 +126,11 @@ class ReqExclScorer extends FilterScorer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public TwoPhaseDocIdSetIterator asTwoPhaseIterator() {
|
||||
public TwoPhaseIterator asTwoPhaseIterator() {
|
||||
if (reqTwoPhaseIterator == null) {
|
||||
return null;
|
||||
}
|
||||
return new TwoPhaseDocIdSetIterator() {
|
||||
return new TwoPhaseIterator() {
|
||||
|
||||
@Override
|
||||
public DocIdSetIterator approximation() {
|
||||
|
|
|
@ -48,7 +48,7 @@ class ReqOptSumScorer extends Scorer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public TwoPhaseDocIdSetIterator asTwoPhaseIterator() {
|
||||
public TwoPhaseIterator asTwoPhaseIterator() {
|
||||
return reqScorer.asTwoPhaseIterator();
|
||||
}
|
||||
|
||||
|
|
|
@ -102,12 +102,12 @@ public abstract class Scorer extends DocIdSetIterator {
|
|||
}
|
||||
|
||||
/**
|
||||
* Optional method: Return a {@link TwoPhaseDocIdSetIterator} view of this
|
||||
* Optional method: Return a {@link TwoPhaseIterator} view of this
|
||||
* {@link Scorer}. A return value of {@code null} indicates that
|
||||
* two-phase iteration is not supported.
|
||||
*
|
||||
* Note that the returned {@link TwoPhaseDocIdSetIterator}'s
|
||||
* {@link TwoPhaseDocIdSetIterator#approximation() approximation} must
|
||||
* Note that the returned {@link TwoPhaseIterator}'s
|
||||
* {@link TwoPhaseIterator#approximation() approximation} must
|
||||
* advance synchronously with this iterator: advancing the approximation must
|
||||
* advance this iterator and vice-versa.
|
||||
*
|
||||
|
@ -116,7 +116,7 @@ public abstract class Scorer extends DocIdSetIterator {
|
|||
*
|
||||
* The default implementation returns {@code null}.
|
||||
*/
|
||||
public TwoPhaseDocIdSetIterator asTwoPhaseIterator() {
|
||||
public TwoPhaseIterator asTwoPhaseIterator() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ final class ScorerPriorityQueue implements Iterable<org.apache.lucene.search.Sco
|
|||
final DocIdSetIterator approximation;
|
||||
// A two-phase view of the scorer, or null if the scorer does not support
|
||||
// two-phase iteration
|
||||
final TwoPhaseDocIdSetIterator twoPhaseView;
|
||||
final TwoPhaseIterator twoPhaseView;
|
||||
|
||||
ScorerWrapper(Scorer scorer) {
|
||||
this.scorer = scorer;
|
||||
|
|
|
@ -589,8 +589,8 @@ final class SloppyPhraseScorer extends Scorer {
|
|||
public String toString() { return "scorer(" + weight + ")"; }
|
||||
|
||||
@Override
|
||||
public TwoPhaseDocIdSetIterator asTwoPhaseIterator() {
|
||||
return new TwoPhaseDocIdSetIterator() {
|
||||
public TwoPhaseIterator asTwoPhaseIterator() {
|
||||
return new TwoPhaseIterator() {
|
||||
@Override
|
||||
public DocIdSetIterator approximation() {
|
||||
return conjunction;
|
||||
|
|
|
@ -26,11 +26,11 @@ import java.io.IOException;
|
|||
* returned doc ID actually matches.
|
||||
* @lucene.experimental
|
||||
*/
|
||||
public abstract class TwoPhaseDocIdSetIterator {
|
||||
public abstract class TwoPhaseIterator {
|
||||
|
||||
/** Return a {@link DocIdSetIterator} view of the provided
|
||||
* {@link TwoPhaseDocIdSetIterator}. */
|
||||
public static DocIdSetIterator asDocIdSetIterator(TwoPhaseDocIdSetIterator twoPhaseIterator) {
|
||||
* {@link TwoPhaseIterator}. */
|
||||
public static DocIdSetIterator asDocIdSetIterator(TwoPhaseIterator twoPhaseIterator) {
|
||||
final DocIdSetIterator approximation = twoPhaseIterator.approximation();
|
||||
return new DocIdSetIterator() {
|
||||
|
|
@ -27,8 +27,8 @@ import org.apache.lucene.util.TestUtil;
|
|||
|
||||
public class TestConjunctionDISI extends LuceneTestCase {
|
||||
|
||||
private static TwoPhaseDocIdSetIterator approximation(final DocIdSetIterator iterator, final FixedBitSet confirmed) {
|
||||
return new TwoPhaseDocIdSetIterator() {
|
||||
private static TwoPhaseIterator approximation(final DocIdSetIterator iterator, final FixedBitSet confirmed) {
|
||||
return new TwoPhaseIterator() {
|
||||
|
||||
@Override
|
||||
public DocIdSetIterator approximation() {
|
||||
|
@ -42,23 +42,23 @@ public class TestConjunctionDISI extends LuceneTestCase {
|
|||
};
|
||||
}
|
||||
|
||||
private static Scorer scorer(TwoPhaseDocIdSetIterator twoPhaseIterator) {
|
||||
return scorer(TwoPhaseDocIdSetIterator.asDocIdSetIterator(twoPhaseIterator), twoPhaseIterator);
|
||||
private static Scorer scorer(TwoPhaseIterator twoPhaseIterator) {
|
||||
return scorer(TwoPhaseIterator.asDocIdSetIterator(twoPhaseIterator), twoPhaseIterator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a {@link Scorer} that wraps the given {@link DocIdSetIterator}. It
|
||||
* also accepts a {@link TwoPhaseDocIdSetIterator} view, which is exposed in
|
||||
* also accepts a {@link TwoPhaseIterator} view, which is exposed in
|
||||
* {@link Scorer#asTwoPhaseIterator()}. When the two-phase view is not null,
|
||||
* then {@link Scorer#nextDoc()} and {@link Scorer#advance(int)} will raise
|
||||
* an exception in order to make sure that {@link ConjunctionDISI} takes
|
||||
* advantage of the {@link TwoPhaseDocIdSetIterator} view.
|
||||
* advantage of the {@link TwoPhaseIterator} view.
|
||||
*/
|
||||
private static Scorer scorer(DocIdSetIterator it, TwoPhaseDocIdSetIterator twoPhaseIterator) {
|
||||
private static Scorer scorer(DocIdSetIterator it, TwoPhaseIterator twoPhaseIterator) {
|
||||
return new Scorer(null) {
|
||||
|
||||
@Override
|
||||
public TwoPhaseDocIdSetIterator asTwoPhaseIterator() {
|
||||
public TwoPhaseIterator asTwoPhaseIterator() {
|
||||
return twoPhaseIterator;
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ public class TestConjunctionDISI extends LuceneTestCase {
|
|||
// scorer with approximation
|
||||
final FixedBitSet confirmed = clearRandomBits(set);
|
||||
sets[i] = confirmed;
|
||||
final TwoPhaseDocIdSetIterator approximation = approximation(new BitDocIdSet(set).iterator(), confirmed);
|
||||
final TwoPhaseIterator approximation = approximation(new BitDocIdSet(set).iterator(), confirmed);
|
||||
iterators[i] = scorer(approximation);
|
||||
}
|
||||
}
|
||||
|
@ -191,17 +191,17 @@ public class TestConjunctionDISI extends LuceneTestCase {
|
|||
// scorer with approximation
|
||||
final FixedBitSet confirmed = clearRandomBits(set);
|
||||
sets[i] = confirmed;
|
||||
final TwoPhaseDocIdSetIterator approximation = approximation(new BitDocIdSet(set).iterator(), confirmed);
|
||||
final TwoPhaseIterator approximation = approximation(new BitDocIdSet(set).iterator(), confirmed);
|
||||
iterators[i] = scorer(approximation);
|
||||
hasApproximation = true;
|
||||
}
|
||||
}
|
||||
|
||||
final ConjunctionDISI conjunction = ConjunctionDISI.intersect(Arrays.asList(iterators));
|
||||
TwoPhaseDocIdSetIterator twoPhaseIterator = conjunction.asTwoPhaseIterator();
|
||||
TwoPhaseIterator twoPhaseIterator = conjunction.asTwoPhaseIterator();
|
||||
assertEquals(hasApproximation, twoPhaseIterator != null);
|
||||
if (hasApproximation) {
|
||||
assertEquals(intersect(sets), toBitSet(maxDoc, TwoPhaseDocIdSetIterator.asDocIdSetIterator(twoPhaseIterator)));
|
||||
assertEquals(intersect(sets), toBitSet(maxDoc, TwoPhaseIterator.asDocIdSetIterator(twoPhaseIterator)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ public class TestConjunctionDISI extends LuceneTestCase {
|
|||
// scorer with approximation
|
||||
final FixedBitSet confirmed = clearRandomBits(set);
|
||||
sets[i] = confirmed;
|
||||
final TwoPhaseDocIdSetIterator approximation = approximation(new BitDocIdSet(set).iterator(), confirmed);
|
||||
final TwoPhaseIterator approximation = approximation(new BitDocIdSet(set).iterator(), confirmed);
|
||||
newIterator = scorer(approximation);
|
||||
hasApproximation = true;
|
||||
}
|
||||
|
@ -239,10 +239,10 @@ public class TestConjunctionDISI extends LuceneTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
TwoPhaseDocIdSetIterator twoPhaseIterator = ((Scorer) conjunction).asTwoPhaseIterator();
|
||||
TwoPhaseIterator twoPhaseIterator = ((Scorer) conjunction).asTwoPhaseIterator();
|
||||
assertEquals(hasApproximation, twoPhaseIterator != null);
|
||||
if (hasApproximation) {
|
||||
assertEquals(intersect(sets), toBitSet(maxDoc, TwoPhaseDocIdSetIterator.asDocIdSetIterator(twoPhaseIterator)));
|
||||
assertEquals(intersect(sets), toBitSet(maxDoc, TwoPhaseIterator.asDocIdSetIterator(twoPhaseIterator)));
|
||||
} else {
|
||||
assertEquals(intersect(sets), toBitSet(maxDoc, conjunction));
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ public class RandomApproximationQuery extends Query {
|
|||
}
|
||||
|
||||
@Override
|
||||
public TwoPhaseDocIdSetIterator asTwoPhaseIterator() {
|
||||
public TwoPhaseIterator asTwoPhaseIterator() {
|
||||
return twoPhaseView;
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ public class RandomApproximationQuery extends Query {
|
|||
|
||||
}
|
||||
|
||||
private static class RandomTwoPhaseView extends TwoPhaseDocIdSetIterator {
|
||||
private static class RandomTwoPhaseView extends TwoPhaseIterator {
|
||||
|
||||
private final DocIdSetIterator disi;
|
||||
private final RandomApproximation approximation;
|
||||
|
|
Loading…
Reference in New Issue