From 3e9dff8b7e7672eece3593ea3bc6e920ebd95f89 Mon Sep 17 00:00:00 2001 From: kimchy Date: Fri, 17 Jun 2011 19:23:08 +0300 Subject: [PATCH] add kstem also to the static shared token filters --- .../elasticsearch/index/analysis/AnalysisModule.java | 2 +- .../indices/analysis/IndicesAnalysisService.java | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/analysis/AnalysisModule.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/analysis/AnalysisModule.java index de168e02348..121ac0414eb 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/analysis/AnalysisModule.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/analysis/AnalysisModule.java @@ -330,7 +330,7 @@ public class AnalysisModule extends AbstractModule { tokenFiltersBindings.processTokenFilter("length", LengthTokenFilterFactory.class); tokenFiltersBindings.processTokenFilter("lowercase", LowerCaseTokenFilterFactory.class); tokenFiltersBindings.processTokenFilter("porter_stem", PorterStemTokenFilterFactory.class); - tokenFiltersBindings.processTokenFilter("k_stem", KStemTokenFilterFactory.class); + tokenFiltersBindings.processTokenFilter("kstem", KStemTokenFilterFactory.class); tokenFiltersBindings.processTokenFilter("standard", StandardTokenFilterFactory.class); tokenFiltersBindings.processTokenFilter("nGram", NGramTokenFilterFactory.class); tokenFiltersBindings.processTokenFilter("ngram", NGramTokenFilterFactory.class); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/indices/analysis/IndicesAnalysisService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/indices/analysis/IndicesAnalysisService.java index 62a846ba763..169217fb30f 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/indices/analysis/IndicesAnalysisService.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/indices/analysis/IndicesAnalysisService.java @@ -34,6 +34,7 @@ import org.apache.lucene.analysis.de.GermanAnalyzer; import org.apache.lucene.analysis.de.GermanStemFilter; import org.apache.lucene.analysis.el.GreekAnalyzer; import org.apache.lucene.analysis.en.EnglishAnalyzer; +import org.apache.lucene.analysis.en.KStemFilter; import org.apache.lucene.analysis.es.SpanishAnalyzer; import org.apache.lucene.analysis.eu.BasqueAnalyzer; import org.apache.lucene.analysis.fa.PersianAnalyzer; @@ -341,6 +342,16 @@ public class IndicesAnalysisService extends AbstractComponent { } })); + tokenFilterFactories.put("kstem", new PreBuiltTokenFilterFactoryFactory(new TokenFilterFactory() { + @Override public String name() { + return "kstem"; + } + + @Override public TokenStream create(TokenStream tokenStream) { + return new KStemFilter(tokenStream); + } + })); + tokenFilterFactories.put("porter_stem", new PreBuiltTokenFilterFactoryFactory(new TokenFilterFactory() { @Override public String name() { return "porter_stem";