Apache Solr open-source search software
LUCENE-5468: remove redundant 'append' in Affix
Robert Muir48f55644505c
diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell2/Affix.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell2/Affix.javaindex 443c006c97d..47a81480d6c 100644--- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell2/Affix.java+++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell2/Affix.java@@ -24,7 +24,6 @@ import java.util.regex.Pattern;*/final class Affix {- private String append; // the affix itself, what is appendedprivate char appendFlags[]; // continuation class flagsprivate String strip;@@ -44,24 +43,6 @@ final class Affix {return conditionPattern.matcher(text).matches();}- /**- * Returns the append defined for the affix- *- * @return Defined append- */- public String getAppend() {- return append;- }-- /**- * Sets the append defined for the affix- *- * @param append Defined append for the affix- */- public void setAppend(String append) {- this.append = append;- }-/*** Returns the flags defined for the affix append*diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell2/Dictionary.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell2/Dictionary.javaindex 0456d9946d3..713bc92210c 100644--- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell2/Dictionary.java+++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell2/Dictionary.java@@ -257,9 +257,7 @@ public class Dictionary {char appendFlags[] = flagParsingStrategy.parseFlags(flagPart);Arrays.sort(appendFlags);affix.setAppendFlags(appendFlags);- affix.setAppend(affixArg.substring(0, flagSep));- } else {- affix.setAppend(affixArg);+ affixArg = affixArg.substring(0, flagSep);}String condition = ruleArgs[4];@@ -283,10 +281,10 @@ public class Dictionary {affix.setCondition(patterns.get(patternIndex));affix.setCrossProduct(crossProduct);- List<Affix> list = affixes.get(affix.getAppend());+ List<Affix> list = affixes.get(affixArg);if (list == null) {list = new ArrayList<Affix>();- affixes.put(affix.getAppend(), list);+ affixes.put(affixArg, list);}list.add(affix);diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell2/Stemmer.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell2/Stemmer.javaindex aa00836d6fe..62096ef96cf 100644--- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell2/Stemmer.java+++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell2/Stemmer.java@@ -126,7 +126,8 @@ final class Stemmer {for (Affix suffix : suffixes) {if (hasCrossCheckedFlag(suffix.getFlag(), flags)) {- int deAffixedLength = length - suffix.getAppend().length();+ int appendLength = length - i;+ int deAffixedLength = length - appendLength;// TODO: can we do this in-place?String strippedWord = new StringBuilder().append(word, 0, deAffixedLength).append(suffix.getStrip()).toString();@@ -148,7 +149,7 @@ final class Stemmer {for (Affix prefix : prefixes) {if (hasCrossCheckedFlag(prefix.getFlag(), flags)) {- int deAffixedStart = prefix.getAppend().length();+ int deAffixedStart = i;int deAffixedLength = length - deAffixedStart;String strippedWord = new StringBuilder().append(prefix.getStrip())