You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "gsmiller (via GitHub)" <gi...@apache.org> on 2023/05/09 16:30:19 UTC

[GitHub] [lucene] gsmiller commented on a diff in pull request #12280: Expose iterator over query terms in TermInSetQuery

gsmiller commented on code in PR #12280:
URL: https://github.com/apache/lucene/pull/12280#discussion_r1188857287


##########
lucene/sandbox/src/java/org/apache/lucene/sandbox/search/PKTermInSetQuery.java:
##########
@@ -0,0 +1,117 @@
+package org.apache.lucene.sandbox.search;
+
+import java.io.IOException;
+import java.util.Collection;
+import org.apache.lucene.index.ImpactsEnum;
+import org.apache.lucene.index.PostingsEnum;
+import org.apache.lucene.index.TermState;
+import org.apache.lucene.index.Terms;
+import org.apache.lucene.index.TermsEnum;
+import org.apache.lucene.search.TermInSetQuery;
+import org.apache.lucene.util.AttributeSource;
+import org.apache.lucene.util.BytesRef;
+import org.apache.lucene.util.BytesRefIterator;
+
+/**
+ * {@link TermInSetQuery} optimized for a primary key-like field.
+ *
+ * <p>Relies on {@link TermsEnum#seekExact(BytesRef)} instead of {@link
+ * TermsEnum#seekCeil(BytesRef)} to produce a terms iterator, which is compatible with {@code
+ * BloomFilteringPostingsFormat}.
+ */
+public class PKTermInSetQuery extends TermInSetQuery {

Review Comment:
   This class is for demo purposes only. I'm not suggesting we merge it as part of this PR. I only want to demonstrate how a class might leverage `getQueryTerms`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org