dweiss commented on code in PR #15332:
URL: https://github.com/apache/lucene/pull/15332#discussion_r2425681764


##########
lucene/core/src/java/org/apache/lucene/search/PhraseQuery.java:
##########
@@ -128,6 +136,13 @@ public Builder add(Term term, int position) {
                 + " and "
                 + terms.get(0).field());
       }
+      if (termThreshold > 0 && terms.size() >= termThreshold) {
+        throw new IllegalArgumentException(
+            "The current value of terms is "

Review Comment:
   ```suggestion
               "The current number of terms is "
   ```



##########
lucene/core/src/test/org/apache/lucene/search/TestPhraseQuery.java:
##########
@@ -743,6 +743,20 @@ public void testBackwardPositions() throws Exception {
         });
   }
 
+  public void testPhraseQueryTermLimit() throws Exception {
+    PhraseQuery.Builder builder = new PhraseQuery.Builder();
+    int termLimit = 1000;

Review Comment:
   Use a smaller termLimit (5) - it makes little sense to make the test run for 
1000 terms. Also, I'd change the loops to not use positions 0..termLimit-1 and 
then check for failure on termLimit - seems more intuitive.



-- 
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]

Reply via email to