this.language = Strings.capitalize(settings.get("language", settings.get("name", "porter")));
}
@Override
public TokenStream create(TokenStream tokenStream) {
final Version indexVersion = Version.indexCreated(indexSettings);
if ("arabic".equalsIgnoreCase(language)) {
return new ArabicStemFilter(tokenStream);
} else if ("armenian".equalsIgnoreCase(language)) {
return new SnowballFilter(tokenStream, new ArmenianStemmer());
} else if ("basque".equalsIgnoreCase(language)) {
return new SnowballFilter(tokenStream, new BasqueStemmer());
} else if ("brazilian".equalsIgnoreCase(language)) {
return new BrazilianStemFilter(tokenStream);
} else if ("bulgarian".equalsIgnoreCase(language)) {
return new BulgarianStemFilter(tokenStream);
} else if ("catalan".equalsIgnoreCase(language)) {
return new SnowballFilter(tokenStream, new CatalanStemmer());
} else if ("czech".equalsIgnoreCase(language)) {
return new CzechStemFilter(tokenStream);
} else if ("danish".equalsIgnoreCase(language)) {
return new SnowballFilter(tokenStream, new DanishStemmer());
// Dutch stemmers
} else if ("dutch".equalsIgnoreCase(language)) {
return new SnowballFilter(tokenStream, new DutchStemmer());
} else if ("dutch_kp".equalsIgnoreCase(language) || "dutchKp".equalsIgnoreCase(language) || "kp".equalsIgnoreCase(language)) {
return new SnowballFilter(tokenStream, new KpStemmer());
// English stemmers
} else if ("english".equalsIgnoreCase(language)) {
if (indexVersion.onOrAfter(Version.V_1_3_0)) {
return new PorterStemFilter(tokenStream);
} else {
return new SnowballFilter(tokenStream, new EnglishStemmer());
}
} else if ("light_english".equalsIgnoreCase(language) || "lightEnglish".equalsIgnoreCase(language)
|| "kstem".equalsIgnoreCase(language)) {
return new KStemFilter(tokenStream);
} else if ("lovins".equalsIgnoreCase(language)) {
return new SnowballFilter(tokenStream, new LovinsStemmer());
} else if ("porter".equalsIgnoreCase(language)) {
return new PorterStemFilter(tokenStream);
} else if ("porter2".equalsIgnoreCase(language)) {
if (indexVersion.onOrAfter(Version.V_1_3_0)) {
return new SnowballFilter(tokenStream, new EnglishStemmer());
} else {
return new SnowballFilter(tokenStream, new PorterStemmer());
}
} else if ("minimal_english".equalsIgnoreCase(language) || "minimalEnglish".equalsIgnoreCase(language)) {