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:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to