You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2020/10/07 11:09:50 UTC
[lucene-solr] branch branch_8x updated: LUCENE-9566
TestApproximationSearchEquivalence.testExclusion fix (#1955)
This is an automated email from the ASF dual-hosted git repository.
mayya pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/branch_8x by this push:
new e914862 LUCENE-9566 TestApproximationSearchEquivalence.testExclusion fix (#1955)
e914862 is described below
commit e914862ff64b7677225e9ea932bf07ad5023ba69
Author: Mayya Sharipova <ma...@elastic.co>
AuthorDate: Wed Oct 7 07:02:46 2020 -0400
LUCENE-9566 TestApproximationSearchEquivalence.testExclusion fix (#1955)
---
lucene/core/src/java/org/apache/lucene/search/Weight.java | 15 ++++++---------
.../lucene/search/TestApproximationSearchEquivalence.java | 1 -
2 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/lucene/core/src/java/org/apache/lucene/search/Weight.java b/lucene/core/src/java/org/apache/lucene/search/Weight.java
index 75acefe..a26d1a3 100644
--- a/lucene/core/src/java/org/apache/lucene/search/Weight.java
+++ b/lucene/core/src/java/org/apache/lucene/search/Weight.java
@@ -223,7 +223,7 @@ public abstract class Weight implements SegmentCacheable {
} else {
if (scorerIterator.docID() != -1) {
// Wrap ScorerIterator to start from -1 for conjunction
- scorerIterator = new RangeDISIWrapper(scorerIterator, max);
+ scorerIterator = new StartDISIWrapper(scorerIterator);
}
// filter scorerIterator to keep only competitive docs as defined by collector
filteredIterator = ConjunctionDISI.intersectIterators(Arrays.asList(scorerIterator, collectorIterator));
@@ -290,16 +290,14 @@ public abstract class Weight implements SegmentCacheable {
/**
* Wraps an internal docIdSetIterator for it to start with docID = -1
*/
- protected static class RangeDISIWrapper extends DocIdSetIterator {
+ protected static class StartDISIWrapper extends DocIdSetIterator {
private final DocIdSetIterator in;
private final int min;
- private final int max;
private int docID = -1;
- public RangeDISIWrapper(DocIdSetIterator in, int max) {
+ public StartDISIWrapper(DocIdSetIterator in) {
this.in = in;
this.min = in.docID();
- this.max = max;
}
@Override
@@ -314,16 +312,15 @@ public abstract class Weight implements SegmentCacheable {
@Override
public int advance(int target) throws IOException {
- target = Math.max(min, target);
- if (target >= max) {
- return docID = NO_MORE_DOCS;
+ if (target <= min) {
+ return docID = min;
}
return docID = in.advance(target);
}
@Override
public long cost() {
- return Math.min(max - min, in.cost());
+ return in.cost();
}
}
diff --git a/lucene/core/src/test/org/apache/lucene/search/TestApproximationSearchEquivalence.java b/lucene/core/src/test/org/apache/lucene/search/TestApproximationSearchEquivalence.java
index 79c68bc..89fc12a 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestApproximationSearchEquivalence.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestApproximationSearchEquivalence.java
@@ -196,7 +196,6 @@ public class TestApproximationSearchEquivalence extends SearchEquivalenceTestBas
assertSameScores(bq1.build(), bq2.build());
}
- @AwaitsFix(bugUrl = "https://issues.apache.org/jira/browse/LUCENE-9566")
public void testExclusion() throws Exception {
Term t1 = randomTerm();
Term t2 = randomTerm();