andywebb1975 commented on a change in pull request #1103: LUCENE-9102 add 
maxQueryLength option to DirectSpellChecker
URL: https://github.com/apache/lucene-solr/pull/1103#discussion_r360481010
 
 

 ##########
 File path: 
lucene/suggest/src/java/org/apache/lucene/search/spell/DirectSpellChecker.java
 ##########
 @@ -317,7 +332,11 @@ public void setDistance(StringDistance distance) {
       SuggestMode suggestMode, float accuracy) throws IOException {
     final CharsRefBuilder spare = new CharsRefBuilder();
     String text = term.text();
-    if (minQueryLength > 0 && text.codePointCount(0, text.length()) < 
minQueryLength)
+
+    int textLength = text.codePointCount(0, text.length());
+    if (minQueryLength > 0 && textLength < minQueryLength)
+      return new SuggestWord[0];
+    if (maxQueryLength > 0 && textLength > maxQueryLength)
 
 Review comment:
   Yes to both!

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to