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


##########
lucene/core/src/java/org/apache/lucene/search/MultiTermQueryConstantScoreWrapper.java:
##########
@@ -165,9 +143,46 @@ private WeightOrDocIdSet rewrite(LeafReaderContext 
context) throws IOException {
 
         PostingsEnum docs = null;
 
-        final List<TermAndState> collectedTerms = new ArrayList<>();
-        if (collectTerms(context, termsEnum, collectedTerms)) {
-          // build a boolean query
+        // We will first try to collect up to 'threshold' terms into 
'matchingTerms'
+        // if there are too many terms, we will fall back to building the 
'builder'

Review Comment:
   > I don't think its worth completely restructuring the code for that case? 
Its only 16 terms at most.
   
   Yeah, that's a fair point. I think we can get the best of both potentially 
anyway (see latest revision). Happy to stay more faithful to the current code 
structure.
   
   > Yeah, I think i could have read it wrong, my bad. I did try to stare for a 
while but I think i got confused by the decision tree.
   
   It's nuanced and slightly tricky code. I've stared at it a lot between this 
and `TermInSetQuery` so it's kind of ingrained in my brain right now, but it is 
a bit tricky to read for sure.



-- 
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-unsubscr...@lucene.apache.org

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


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

Reply via email to