You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by gs...@apache.org on 2022/09/02 14:51:35 UTC
[lucene] branch main updated: Simplify dense optimization check in TermInSetQuery (#11737)
This is an automated email from the ASF dual-hosted git repository.
gsmiller pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/main by this push:
new 84cae4f27cf Simplify dense optimization check in TermInSetQuery (#11737)
84cae4f27cf is described below
commit 84cae4f27cfd3feb3bb42d5a9f7ce034f7a31573
Author: Greg Miller <gs...@gmail.com>
AuthorDate: Fri Sep 2 07:51:29 2022 -0700
Simplify dense optimization check in TermInSetQuery (#11737)
---
.../src/java/org/apache/lucene/search/TermInSetQuery.java | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/lucene/core/src/java/org/apache/lucene/search/TermInSetQuery.java b/lucene/core/src/java/org/apache/lucene/search/TermInSetQuery.java
index 144070e1d9b..d518b6d4fa5 100644
--- a/lucene/core/src/java/org/apache/lucene/search/TermInSetQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/search/TermInSetQuery.java
@@ -281,10 +281,11 @@ public class TermInSetQuery extends Query implements Accountable {
for (BytesRef term = iterator.next(); term != null; term = iterator.next()) {
assert field.equals(iterator.field());
if (termsEnum.seekExact(term)) {
+ if (reader.maxDoc() == termsEnum.docFreq()) {
+ return new WeightOrDocIdSet(DocIdSet.all(reader.maxDoc()));
+ }
+
if (matchingTerms == null) {
- if (reader.maxDoc() == termsEnum.docFreq()) {
- return new WeightOrDocIdSet(DocIdSet.all(reader.maxDoc()));
- }
docs = termsEnum.postings(docs, PostingsEnum.NONE);
builder.add(docs);
} else if (matchingTerms.size() < threshold) {
@@ -292,16 +293,10 @@ public class TermInSetQuery extends Query implements Accountable {
} else {
assert matchingTerms.size() == threshold;
builder = new DocIdSetBuilder(reader.maxDoc(), terms);
- if (reader.maxDoc() == termsEnum.docFreq()) {
- return new WeightOrDocIdSet(DocIdSet.all(reader.maxDoc()));
- }
docs = termsEnum.postings(docs, PostingsEnum.NONE);
builder.add(docs);
for (TermAndState t : matchingTerms) {
t.termsEnum.seekExact(t.term, t.state);
- if (reader.maxDoc() == t.docFreq) {
- return new WeightOrDocIdSet(DocIdSet.all(reader.maxDoc()));
- }
docs = t.termsEnum.postings(docs, PostingsEnum.NONE);
builder.add(docs);
}