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/06 13:27:51 UTC
[lucene-solr] branch branch_8x updated: LUCENE-9555: Advance
conjunction Iterator for two phase iteration (#1943)
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 e7bf2dc LUCENE-9555: Advance conjunction Iterator for two phase iteration (#1943)
e7bf2dc is described below
commit e7bf2dc8b324b65b384904959284aef9630ef761
Author: Mayya Sharipova <ma...@elastic.co>
AuthorDate: Tue Oct 6 09:22:42 2020 -0400
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
---
lucene/core/src/java/org/apache/lucene/search/Weight.java | 6 ++----
1 file changed, 2 insertions(+), 4 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 3f8f05d..d2a0428 100644
--- a/lucene/core/src/java/org/apache/lucene/search/Weight.java
+++ b/lucene/core/src/java/org/apache/lucene/search/Weight.java
@@ -247,12 +247,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;
}
@@ -271,8 +270,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);
}