dweiss commented on a change in pull request #2286:
URL: https://github.com/apache/lucene-solr/pull/2286#discussion_r569201272



##########
File path: 
lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/ModifyingSuggester.java
##########
@@ -30,9 +32,52 @@
   }
 
   LinkedHashSet<String> suggest(String word) {
+    tryVariationsOf(word);
+
+    WordCase wc = WordCase.caseOf(word);
+
+    if (wc == WordCase.MIXED) {
+      int dot = word.indexOf('.');
+      if (dot > 0
+          && dot < word.length() - 1
+          && WordCase.caseOf(word.substring(dot + 1)) == WordCase.TITLE) {
+        result.add(word.substring(0, dot + 1) + " " + word.substring(dot + 1));
+      }
+
+      tryVariationsOf(toLowerCase(word));
+    }
+
+    return result;
+  }
+
+  private String toLowerCase(String word) {

Review comment:
       I'm pretty sure we have a case conversion routine somewhere in the code 
(UnicodeUtil?)... Also, this does char-by-char conversion - it could be done on 
full unicode codepoints (which Java supports). I assume locale should not be 
taken into account here (to be identical to hunspell's behavior?). Don't know 
if this matters.




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



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

Reply via email to