Fix kuromoji default stoptags
Initialize the default stop-tags in `KuromojiPartOfSpeechFilterFactory` if the
`stoptags` are not given in the config. Also adding a test which checks that
part-of-speech tokens are removed when using the kuromoji_part_of_speech
filter.
package org.elasticsearch.index.analysis;
import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.ja.JapaneseAnalyzer;
import org.apache.lucene.analysis.ja.JapanesePartOfSpeechStopFilter;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment;
@@ -38,6 +39,8 @@ public class KuromojiPartOfSpeechFilterFactory extends AbstractTokenFilterFactor
List<String> wordList = Analysis.getWordList(env, settings, "stoptags");
if (wordList != null) {
stopTags.addAll(wordList);
+ } else {
+ stopTags.addAll(JapaneseAnalyzer.getDefaultStopTags());
}
}
