mirror of https://github.com/apache/lucene.git
LUCENE-9555: Advance conjunction Iterator for two phase iteration (#1943)
PR #1351 introduced a sort optimization where documents can be skipped. But there was a bug in case we were using two phase approximation, as we would advance it without advancing an overall conjunction iterator. This patch fixed it. Relates to #1351
This commit is contained in:
parent
b45c43fdeb
commit
6ac94a6f9f
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue