From dd8edd4015378ca05bb28d943b9d20c51a59e1aa Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Mon, 5 Oct 2015 08:52:09 -0400 Subject: [PATCH] Remove one usage of MapBuilder#immutableMap It was causing the build to fail. --- .../index/analysis/JapaneseStopTokenFilterFactory.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/plugins/analysis-kuromoji/src/main/java/org/elasticsearch/index/analysis/JapaneseStopTokenFilterFactory.java b/plugins/analysis-kuromoji/src/main/java/org/elasticsearch/index/analysis/JapaneseStopTokenFilterFactory.java index 433d03d9836..951597111e5 100644 --- a/plugins/analysis-kuromoji/src/main/java/org/elasticsearch/index/analysis/JapaneseStopTokenFilterFactory.java +++ b/plugins/analysis-kuromoji/src/main/java/org/elasticsearch/index/analysis/JapaneseStopTokenFilterFactory.java @@ -25,7 +25,6 @@ import org.apache.lucene.analysis.core.StopFilter; import org.apache.lucene.analysis.ja.JapaneseAnalyzer; import org.apache.lucene.analysis.util.CharArraySet; import org.apache.lucene.search.suggest.analyzing.SuggestStopFilter; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.assistedinject.Assisted; import org.elasticsearch.common.settings.Settings; @@ -36,8 +35,10 @@ import org.elasticsearch.index.settings.IndexSettings; import java.util.Map; import java.util.Set; -public class JapaneseStopTokenFilterFactory extends AbstractTokenFilterFactory{ +import static java.util.Collections.singletonMap; +public class JapaneseStopTokenFilterFactory extends AbstractTokenFilterFactory{ + private static final Map> NAMED_STOP_WORDS = singletonMap("_japanese_", JapaneseAnalyzer.getDefaultStopSet()); private final CharArraySet stopWords; @@ -50,10 +51,7 @@ public class JapaneseStopTokenFilterFactory extends AbstractTokenFilterFactory{ super(index, indexSettings, name, settings); this.ignoreCase = settings.getAsBoolean("ignore_case", false); this.removeTrailing = settings.getAsBoolean("remove_trailing", true); - Map> namedStopWords = MapBuilder.>newMapBuilder() - .put("_japanese_", JapaneseAnalyzer.getDefaultStopSet()) - .immutableMap(); - this.stopWords = Analysis.parseWords(env, settings, "stopwords", JapaneseAnalyzer.getDefaultStopSet(), namedStopWords, ignoreCase); + this.stopWords = Analysis.parseWords(env, settings, "stopwords", JapaneseAnalyzer.getDefaultStopSet(), NAMED_STOP_WORDS, ignoreCase); } @Override