You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2021/02/04 09:52:04 UTC

[GitHub] [lucene-solr] donnerpeter commented on a change in pull request #2300: LUCENE-9729: Hunspell: support CHECKCOMPOUNDREP flags

donnerpeter commented on a change in pull request #2300:
URL: https://github.com/apache/lucene-solr/pull/2300#discussion_r570086999



##########
File path: lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/CheckCompoundPattern.java
##########
@@ -38,36 +38,33 @@
     }
 
     int flagSep = parts[1].indexOf("/");
-    endChars = (flagSep < 0 ? parts[1] : parts[1].substring(0, flagSep)).toCharArray();
+    endChars = flagSep < 0 ? parts[1] : parts[1].substring(0, flagSep);
     endFlags = flagSep < 0 ? new char[0] : strategy.parseFlags(parts[1].substring(flagSep + 1));
 
     flagSep = parts[2].indexOf("/");
-    beginChars = (flagSep < 0 ? parts[2] : parts[2].substring(0, flagSep)).toCharArray();
+    beginChars = flagSep < 0 ? parts[2] : parts[2].substring(0, flagSep);
     beginFlags = flagSep < 0 ? new char[0] : strategy.parseFlags(parts[2].substring(flagSep + 1));
 
-    replacement = parts.length == 3 ? null : parts[3].toCharArray();
+    replacement = parts.length == 3 ? null : parts[3];
   }
 
   @Override
   public String toString() {
-    return new String(endChars)
-        + " "
-        + new String(beginChars)
-        + (replacement == null ? "" : " -> " + new String(replacement));
+    return endChars + " " + beginChars + (replacement == null ? "" : " -> " + replacement);
   }
 
   boolean prohibitsCompounding(
       CharsRef word, int breakPos, CharsRef stemBefore, CharsRef stemAfter) {
     if (isNonAffixedPattern(endChars)) {
-      if (!charsMatch(word, breakPos - stemBefore.length, stemBefore.chars)) {

Review comment:
       There was a bug here: `stemBefore.chars` was checked fully, disregarding `offset/length`. Now we pass in `CharSequence` to avoid that




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



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