Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

LUCENE-9555: Advance conjunction Iterator for two phase iteration (#1943)

Mayya Sharipova6ac94a6f9fba
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 9829836b7e2..772093baad7 100644
--- a/lucene/core/src/java/org/apache/lucene/search/Weight.java
+++ b/lucene/core/src/java/org/apache/lucene/search/Weight.java
@@ -234,12 +234,11 @@ public abstract class Weight implements SegmentCacheable {
}
return currentDoc;
} else {
- final DocIdSetIterator approximation = twoPhase.approximation();
while (currentDoc < end) {
if ((acceptDocs == null || acceptDocs.get(currentDoc)) && twoPhase.matches()) {
collector.collect(currentDoc);
}
- currentDoc = approximation.nextDoc();
+ currentDoc = iterator.nextDoc();
}
return currentDoc;
}
@@ -258,8 +257,7 @@ public abstract class Weight implements SegmentCacheable {
}
} else {
// The scorer has an approximation, so run the approximation first, then check acceptDocs, then confirm
- final DocIdSetIterator approximation = twoPhase.approximation();
- for (int doc = approximation.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = approximation.nextDoc()) {
+ for (int doc = iterator.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = iterator.nextDoc()) {
if ((acceptDocs == null || acceptDocs.get(doc)) && twoPhase.matches()) {
collector.collect(doc);
}