rmuir commented on code in PR #14350:
URL: https://github.com/apache/lucene/pull/14350#discussion_r1992524713


##########
lucene/core/src/java/org/apache/lucene/util/automaton/StringsToAutomaton.java:
##########
@@ -209,7 +209,25 @@ private static int convert(
     int i = 0;
     int[] labels = s.labels;
     for (StringsToAutomaton.State target : s.states) {
-      a.addTransition(converted, convert(a, target, visited), labels[i++]);
+      int label = labels[i++];
+      int dest = convert(a, target, visited, caseInsensitive);
+      a.addTransition(converted, dest, label);
+      if (caseInsensitive) {
+        int[] alternatives = CaseFolding.lookupAlternates(label);
+        if (alternatives != null) {
+          for (int alt : alternatives) {
+            a.addTransition(converted, dest, alt);
+          }
+        } else {
+          int altCase =
+                  Character.isLowerCase(label)
+                          ? Character.toUpperCase(label)
+                          : Character.toLowerCase(label);
+          if (altCase != label) {
+            a.addTransition(converted, dest, altCase);

Review Comment:
   maybe this works because the finishState() will sort the transitions always, 
and still give us the same efficient build?



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