romseygeek commented on code in PR #16484:
URL: https://github.com/apache/lucene/pull/16484#discussion_r3734737690
##########
lucene/queries/src/java/org/apache/lucene/queries/spans/SpanMultiTermQueryWrapper.java:
##########
@@ -252,4 +253,114 @@ public boolean equals(Object obj) {
return delegate.equals(other.delegate);
}
}
+
+ /**
+ * A rewrite method that translates each term into a SpanTermQuery within a
{@link SpanOrQuery},
+ * but retains only the most frequent terms so it will not overflow the
boolean max clause count.
+ *
+ * <p>Unlike {@link TopTermsSpanBooleanQueryRewrite}, which keeps the top
terms by boost, this
+ * method ranks terms by their index statistics — document frequency,
optionally breaking
+ * ties by total term frequency — and keeps the {@code maxSize} most
frequent ones.
+ *
+ * @see #setRewriteMethod
Review Comment:
Unrelated to this PR but: we've removed `setRewriteMethod` for standard MTQs
because mutable Queries can cause weird behaviour around caching, maybe we
should do that for SpanMTQWrapper as well?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]