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:05:16 UTC
[lucene-solr] branch master 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 master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/master by this push:
new 0b08943 LUCENE-9566 TestApproximationSearchEquivalence.testExclusion fix (#1955)
0b08943 is described below
commit 0b0894311223f4df1c6f161bc1ab844aea1f748c
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 ba3755a..4d37fba 100644
--- a/lucene/core/src/java/org/apache/lucene/search/Weight.java
+++ b/lucene/core/src/java/org/apache/lucene/search/Weight.java
@@ -210,7 +210,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));
@@ -277,16 +277,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
@@ -301,16 +299,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();