From e81ee30865cf0fb54564f0e6b375cfa1c5c695a2 Mon Sep 17 00:00:00 2001 From: Martijn van Groningen <martijn.v.groningen@gmail.com> Date: Mon, 18 Jun 2018 11:24:43 +0200 Subject: [PATCH] Move language analyzers from server to analysis-common module. (#31300) The following analyzers were moved from server module to analysis-common module: `greek`, `hindi`, `hungarian`, `indonesian`, `irish`, `italian`, `latvian`, `lithuanian`, `norwegian`, `persian`, `portuguese`, `romanian`, `russian`, `sorani`, `spanish`, `swedish`, `turkish` and `thai`. Relates to #23658 --- .../analysis/common/CommonAnalysisPlugin.java | 62 ++- .../common}/GreekAnalyzerProvider.java | 6 +- .../common}/HindiAnalyzerProvider.java | 6 +- .../common}/HungarianAnalyzerProvider.java | 6 +- .../common}/IndonesianAnalyzerProvider.java | 6 +- .../common}/IrishAnalyzerProvider.java | 6 +- .../common}/ItalianAnalyzerProvider.java | 6 +- .../common}/LatvianAnalyzerProvider.java | 6 +- .../common}/LithuanianAnalyzerProvider.java | 6 +- .../common}/NorwegianAnalyzerProvider.java | 6 +- .../common}/PersianAnalyzerProvider.java | 6 +- .../common}/PortugueseAnalyzerProvider.java | 6 +- .../common}/RomanianAnalyzerProvider.java | 6 +- .../common}/RussianAnalyzerProvider.java | 6 +- .../common}/SoraniAnalyzerProvider.java | 6 +- .../common}/SpanishAnalyzerProvider.java | 6 +- .../common}/SwedishAnalyzerProvider.java | 6 +- .../common}/ThaiAnalyzerProvider.java | 6 +- .../common}/TurkishAnalyzerProvider.java | 6 +- .../test/analysis-common/20_analyzers.yml | 522 ++++++++++++++++++ .../indices/analysis/AnalysisModule.java | 36 -- .../indices/analysis/PreBuiltAnalyzers.java | 180 ------ .../indices/analysis/AnalysisModuleTests.java | 2 +- 23 files changed, 655 insertions(+), 255 deletions(-) rename {server/src/main/java/org/elasticsearch/index/analysis => modules/analysis-common/src/main/java/org/elasticsearch/analysis/common}/GreekAnalyzerProvider.java (84%) rename {server/src/main/java/org/elasticsearch/index/analysis => modules/analysis-common/src/main/java/org/elasticsearch/analysis/common}/HindiAnalyzerProvider.java (85%) rename {server/src/main/java/org/elasticsearch/index/analysis => modules/analysis-common/src/main/java/org/elasticsearch/analysis/common}/HungarianAnalyzerProvider.java (85%) rename {server/src/main/java/org/elasticsearch/index/analysis => modules/analysis-common/src/main/java/org/elasticsearch/analysis/common}/IndonesianAnalyzerProvider.java (85%) rename {server/src/main/java/org/elasticsearch/index/analysis => modules/analysis-common/src/main/java/org/elasticsearch/analysis/common}/IrishAnalyzerProvider.java (85%) rename {server/src/main/java/org/elasticsearch/index/analysis => modules/analysis-common/src/main/java/org/elasticsearch/analysis/common}/ItalianAnalyzerProvider.java (85%) rename {server/src/main/java/org/elasticsearch/index/analysis => modules/analysis-common/src/main/java/org/elasticsearch/analysis/common}/LatvianAnalyzerProvider.java (85%) rename {server/src/main/java/org/elasticsearch/index/analysis => modules/analysis-common/src/main/java/org/elasticsearch/analysis/common}/LithuanianAnalyzerProvider.java (85%) rename {server/src/main/java/org/elasticsearch/index/analysis => modules/analysis-common/src/main/java/org/elasticsearch/analysis/common}/NorwegianAnalyzerProvider.java (85%) rename {server/src/main/java/org/elasticsearch/index/analysis => modules/analysis-common/src/main/java/org/elasticsearch/analysis/common}/PersianAnalyzerProvider.java (84%) rename {server/src/main/java/org/elasticsearch/index/analysis => modules/analysis-common/src/main/java/org/elasticsearch/analysis/common}/PortugueseAnalyzerProvider.java (85%) rename {server/src/main/java/org/elasticsearch/index/analysis => modules/analysis-common/src/main/java/org/elasticsearch/analysis/common}/RomanianAnalyzerProvider.java (85%) rename {server/src/main/java/org/elasticsearch/index/analysis => modules/analysis-common/src/main/java/org/elasticsearch/analysis/common}/RussianAnalyzerProvider.java (85%) rename {server/src/main/java/org/elasticsearch/index/analysis => modules/analysis-common/src/main/java/org/elasticsearch/analysis/common}/SoraniAnalyzerProvider.java (85%) rename {server/src/main/java/org/elasticsearch/index/analysis => modules/analysis-common/src/main/java/org/elasticsearch/analysis/common}/SpanishAnalyzerProvider.java (85%) rename {server/src/main/java/org/elasticsearch/index/analysis => modules/analysis-common/src/main/java/org/elasticsearch/analysis/common}/SwedishAnalyzerProvider.java (85%) rename {server/src/main/java/org/elasticsearch/index/analysis => modules/analysis-common/src/main/java/org/elasticsearch/analysis/common}/ThaiAnalyzerProvider.java (84%) rename {server/src/main/java/org/elasticsearch/index/analysis => modules/analysis-common/src/main/java/org/elasticsearch/analysis/common}/TurkishAnalyzerProvider.java (85%) diff --git a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/CommonAnalysisPlugin.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/CommonAnalysisPlugin.java index 04df77245438c..cdd8101a73c70 100644 --- a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/CommonAnalysisPlugin.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/CommonAnalysisPlugin.java @@ -37,6 +37,7 @@ import org.apache.lucene.analysis.cjk.CJKAnalyzer; import org.apache.lucene.analysis.cjk.CJKBigramFilter; import org.apache.lucene.analysis.cjk.CJKWidthFilter; +import org.apache.lucene.analysis.ckb.SoraniAnalyzer; import org.apache.lucene.analysis.ckb.SoraniNormalizationFilter; import org.apache.lucene.analysis.commongrams.CommonGramsFilter; import org.apache.lucene.analysis.core.DecimalDigitFilter; @@ -52,17 +53,27 @@ import org.apache.lucene.analysis.de.GermanAnalyzer; import org.apache.lucene.analysis.de.GermanNormalizationFilter; 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.en.PorterStemFilter; +import org.apache.lucene.analysis.es.SpanishAnalyzer; import org.apache.lucene.analysis.eu.BasqueAnalyzer; +import org.apache.lucene.analysis.fa.PersianAnalyzer; import org.apache.lucene.analysis.fa.PersianNormalizationFilter; import org.apache.lucene.analysis.fi.FinnishAnalyzer; import org.apache.lucene.analysis.fr.FrenchAnalyzer; +import org.apache.lucene.analysis.ga.IrishAnalyzer; import org.apache.lucene.analysis.gl.GalicianAnalyzer; +import org.apache.lucene.analysis.hi.HindiAnalyzer; import org.apache.lucene.analysis.hi.HindiNormalizationFilter; +import org.apache.lucene.analysis.hu.HungarianAnalyzer; import org.apache.lucene.analysis.hy.ArmenianAnalyzer; +import org.apache.lucene.analysis.id.IndonesianAnalyzer; import org.apache.lucene.analysis.in.IndicNormalizationFilter; +import org.apache.lucene.analysis.it.ItalianAnalyzer; +import org.apache.lucene.analysis.lt.LithuanianAnalyzer; +import org.apache.lucene.analysis.lv.LatvianAnalyzer; import org.apache.lucene.analysis.miscellaneous.ASCIIFoldingFilter; import org.apache.lucene.analysis.miscellaneous.DisableGraphAttribute; import org.apache.lucene.analysis.miscellaneous.KeywordRepeatFilter; @@ -79,19 +90,26 @@ import org.apache.lucene.analysis.ngram.NGramTokenFilter; import org.apache.lucene.analysis.ngram.NGramTokenizer; import org.apache.lucene.analysis.nl.DutchAnalyzer; +import org.apache.lucene.analysis.no.NorwegianAnalyzer; import org.apache.lucene.analysis.path.PathHierarchyTokenizer; import org.apache.lucene.analysis.pattern.PatternTokenizer; import org.apache.lucene.analysis.payloads.DelimitedPayloadTokenFilter; import org.apache.lucene.analysis.payloads.TypeAsPayloadTokenFilter; +import org.apache.lucene.analysis.pt.PortugueseAnalyzer; import org.apache.lucene.analysis.reverse.ReverseStringFilter; +import org.apache.lucene.analysis.ro.RomanianAnalyzer; +import org.apache.lucene.analysis.ru.RussianAnalyzer; import org.apache.lucene.analysis.shingle.ShingleFilter; import org.apache.lucene.analysis.snowball.SnowballFilter; import org.apache.lucene.analysis.standard.ClassicFilter; import org.apache.lucene.analysis.standard.ClassicTokenizer; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.analysis.standard.UAX29URLEmailTokenizer; +import org.apache.lucene.analysis.sv.SwedishAnalyzer; +import org.apache.lucene.analysis.th.ThaiAnalyzer; import org.apache.lucene.analysis.th.ThaiTokenizer; import org.apache.lucene.analysis.tr.ApostropheFilter; +import org.apache.lucene.analysis.tr.TurkishAnalyzer; import org.apache.lucene.analysis.util.ElisionFilter; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.Loggers; @@ -130,6 +148,8 @@ public Map<String, AnalysisProvider<AnalyzerProvider<? extends Analyzer>>> getAn analyzers.put("standard_html_strip", StandardHtmlStripAnalyzerProvider::new); analyzers.put("pattern", PatternAnalyzerProvider::new); analyzers.put("snowball", SnowballAnalyzerProvider::new); + + // Language analyzers: analyzers.put("arabic", ArabicAnalyzerProvider::new); analyzers.put("armenian", ArmenianAnalyzerProvider::new); analyzers.put("basque", BasqueAnalyzerProvider::new); @@ -147,6 +167,24 @@ public Map<String, AnalysisProvider<AnalyzerProvider<? extends Analyzer>>> getAn analyzers.put("french", FrenchAnalyzerProvider::new); analyzers.put("galician", GalicianAnalyzerProvider::new); analyzers.put("german", GermanAnalyzerProvider::new); + analyzers.put("greek", GreekAnalyzerProvider::new); + analyzers.put("hindi", HindiAnalyzerProvider::new); + analyzers.put("hungarian", HungarianAnalyzerProvider::new); + analyzers.put("indonesian", IndonesianAnalyzerProvider::new); + analyzers.put("irish", IrishAnalyzerProvider::new); + analyzers.put("italian", ItalianAnalyzerProvider::new); + analyzers.put("latvian", LatvianAnalyzerProvider::new); + analyzers.put("lithuanian", LithuanianAnalyzerProvider::new); + analyzers.put("norwegian", NorwegianAnalyzerProvider::new); + analyzers.put("persian", PersianAnalyzerProvider::new); + analyzers.put("portuguese", PortugueseAnalyzerProvider::new); + analyzers.put("romanian", RomanianAnalyzerProvider::new); + analyzers.put("russian", RussianAnalyzerProvider::new); + analyzers.put("sorani", SoraniAnalyzerProvider::new); + analyzers.put("spanish", SpanishAnalyzerProvider::new); + analyzers.put("swedish", SwedishAnalyzerProvider::new); + analyzers.put("turkish", TurkishAnalyzerProvider::new); + analyzers.put("thai", ThaiAnalyzerProvider::new); return analyzers; } @@ -248,13 +286,15 @@ public Map<String, AnalysisProvider<TokenizerFactory>> getTokenizers() { @Override public List<PreBuiltAnalyzerProviderFactory> getPreBuiltAnalyzerProviderFactories() { List<PreBuiltAnalyzerProviderFactory> analyzers = new ArrayList<>(); - analyzers.add(new PreBuiltAnalyzerProviderFactory("standard_html_strip", CachingStrategy.LUCENE, + analyzers.add(new PreBuiltAnalyzerProviderFactory("standard_html_strip", CachingStrategy.ELASTICSEARCH, () -> new StandardHtmlStripAnalyzer(CharArraySet.EMPTY_SET))); analyzers.add(new PreBuiltAnalyzerProviderFactory("pattern", CachingStrategy.ELASTICSEARCH, () -> new PatternAnalyzer(Regex.compile("\\W+" /*PatternAnalyzer.NON_WORD_PATTERN*/, null), true, CharArraySet.EMPTY_SET))); analyzers.add(new PreBuiltAnalyzerProviderFactory("snowball", CachingStrategy.LUCENE, () -> new SnowballAnalyzer("English", StopAnalyzer.ENGLISH_STOP_WORDS_SET))); + + // Language analyzers: analyzers.add(new PreBuiltAnalyzerProviderFactory("arabic", CachingStrategy.LUCENE, ArabicAnalyzer::new)); analyzers.add(new PreBuiltAnalyzerProviderFactory("armenian", CachingStrategy.LUCENE, ArmenianAnalyzer::new)); analyzers.add(new PreBuiltAnalyzerProviderFactory("basque", CachingStrategy.LUCENE, BasqueAnalyzer::new)); @@ -263,7 +303,7 @@ public List<PreBuiltAnalyzerProviderFactory> getPreBuiltAnalyzerProviderFactorie analyzers.add(new PreBuiltAnalyzerProviderFactory("bulgarian", CachingStrategy.LUCENE, BulgarianAnalyzer::new)); analyzers.add(new PreBuiltAnalyzerProviderFactory("catalan", CachingStrategy.LUCENE, CatalanAnalyzer::new)); // chinese analyzer: only for old indices, best effort - analyzers.add(new PreBuiltAnalyzerProviderFactory("chinese", CachingStrategy.LUCENE, StandardAnalyzer::new)); + analyzers.add(new PreBuiltAnalyzerProviderFactory("chinese", CachingStrategy.ONE, StandardAnalyzer::new)); analyzers.add(new PreBuiltAnalyzerProviderFactory("cjk", CachingStrategy.LUCENE, CJKAnalyzer::new)); analyzers.add(new PreBuiltAnalyzerProviderFactory("czech", CachingStrategy.LUCENE, CzechAnalyzer::new)); analyzers.add(new PreBuiltAnalyzerProviderFactory("danish", CachingStrategy.LUCENE, DanishAnalyzer::new)); @@ -273,6 +313,24 @@ public List<PreBuiltAnalyzerProviderFactory> getPreBuiltAnalyzerProviderFactorie analyzers.add(new PreBuiltAnalyzerProviderFactory("french", CachingStrategy.LUCENE, FrenchAnalyzer::new)); analyzers.add(new PreBuiltAnalyzerProviderFactory("galician", CachingStrategy.LUCENE, GalicianAnalyzer::new)); analyzers.add(new PreBuiltAnalyzerProviderFactory("german", CachingStrategy.LUCENE, GermanAnalyzer::new)); + analyzers.add(new PreBuiltAnalyzerProviderFactory("greek", CachingStrategy.LUCENE, GreekAnalyzer::new)); + analyzers.add(new PreBuiltAnalyzerProviderFactory("hindi", CachingStrategy.LUCENE, HindiAnalyzer::new)); + analyzers.add(new PreBuiltAnalyzerProviderFactory("hungarian", CachingStrategy.LUCENE, HungarianAnalyzer::new)); + analyzers.add(new PreBuiltAnalyzerProviderFactory("indonesian", CachingStrategy.LUCENE, IndonesianAnalyzer::new)); + analyzers.add(new PreBuiltAnalyzerProviderFactory("irish", CachingStrategy.LUCENE, IrishAnalyzer::new)); + analyzers.add(new PreBuiltAnalyzerProviderFactory("italian", CachingStrategy.LUCENE, ItalianAnalyzer::new)); + analyzers.add(new PreBuiltAnalyzerProviderFactory("latvian", CachingStrategy.LUCENE, LatvianAnalyzer::new)); + analyzers.add(new PreBuiltAnalyzerProviderFactory("lithuanian", CachingStrategy.LUCENE, LithuanianAnalyzer::new)); + analyzers.add(new PreBuiltAnalyzerProviderFactory("norwegian", CachingStrategy.LUCENE, NorwegianAnalyzer::new)); + analyzers.add(new PreBuiltAnalyzerProviderFactory("persian", CachingStrategy.LUCENE, PersianAnalyzer::new)); + analyzers.add(new PreBuiltAnalyzerProviderFactory("portuguese", CachingStrategy.LUCENE, PortugueseAnalyzer::new)); + analyzers.add(new PreBuiltAnalyzerProviderFactory("romanian", CachingStrategy.LUCENE, RomanianAnalyzer::new)); + analyzers.add(new PreBuiltAnalyzerProviderFactory("russian", CachingStrategy.LUCENE, RussianAnalyzer::new)); + analyzers.add(new PreBuiltAnalyzerProviderFactory("sorani", CachingStrategy.LUCENE, SoraniAnalyzer::new)); + analyzers.add(new PreBuiltAnalyzerProviderFactory("spanish", CachingStrategy.LUCENE, SpanishAnalyzer::new)); + analyzers.add(new PreBuiltAnalyzerProviderFactory("swedish", CachingStrategy.LUCENE, SwedishAnalyzer::new)); + analyzers.add(new PreBuiltAnalyzerProviderFactory("turkish", CachingStrategy.LUCENE, TurkishAnalyzer::new)); + analyzers.add(new PreBuiltAnalyzerProviderFactory("thai", CachingStrategy.LUCENE, ThaiAnalyzer::new)); return analyzers; } diff --git a/server/src/main/java/org/elasticsearch/index/analysis/GreekAnalyzerProvider.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/GreekAnalyzerProvider.java similarity index 84% rename from server/src/main/java/org/elasticsearch/index/analysis/GreekAnalyzerProvider.java rename to modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/GreekAnalyzerProvider.java index 012fc64c97166..3cf1f911e48cc 100644 --- a/server/src/main/java/org/elasticsearch/index/analysis/GreekAnalyzerProvider.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/GreekAnalyzerProvider.java @@ -17,18 +17,20 @@ * under the License. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.analysis.common; import org.apache.lucene.analysis.el.GreekAnalyzer; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.IndexSettings; +import org.elasticsearch.index.analysis.AbstractIndexAnalyzerProvider; +import org.elasticsearch.index.analysis.Analysis; public class GreekAnalyzerProvider extends AbstractIndexAnalyzerProvider<GreekAnalyzer> { private final GreekAnalyzer analyzer; - public GreekAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { + GreekAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { super(indexSettings, name, settings); analyzer = new GreekAnalyzer( Analysis.parseStopWords(env, indexSettings.getIndexVersionCreated(), settings, GreekAnalyzer.getDefaultStopSet())); diff --git a/server/src/main/java/org/elasticsearch/index/analysis/HindiAnalyzerProvider.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/HindiAnalyzerProvider.java similarity index 85% rename from server/src/main/java/org/elasticsearch/index/analysis/HindiAnalyzerProvider.java rename to modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/HindiAnalyzerProvider.java index 43ebe2677aec7..7b73c119a86f6 100644 --- a/server/src/main/java/org/elasticsearch/index/analysis/HindiAnalyzerProvider.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/HindiAnalyzerProvider.java @@ -17,19 +17,21 @@ * under the License. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.analysis.common; import org.apache.lucene.analysis.CharArraySet; import org.apache.lucene.analysis.hi.HindiAnalyzer; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.IndexSettings; +import org.elasticsearch.index.analysis.AbstractIndexAnalyzerProvider; +import org.elasticsearch.index.analysis.Analysis; public class HindiAnalyzerProvider extends AbstractIndexAnalyzerProvider<HindiAnalyzer> { private final HindiAnalyzer analyzer; - public HindiAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { + HindiAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { super(indexSettings, name, settings); analyzer = new HindiAnalyzer( Analysis.parseStopWords(env, indexSettings.getIndexVersionCreated(), settings, HindiAnalyzer.getDefaultStopSet()), diff --git a/server/src/main/java/org/elasticsearch/index/analysis/HungarianAnalyzerProvider.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/HungarianAnalyzerProvider.java similarity index 85% rename from server/src/main/java/org/elasticsearch/index/analysis/HungarianAnalyzerProvider.java rename to modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/HungarianAnalyzerProvider.java index 81745ba0f2716..5ce948819c6ae 100644 --- a/server/src/main/java/org/elasticsearch/index/analysis/HungarianAnalyzerProvider.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/HungarianAnalyzerProvider.java @@ -17,19 +17,21 @@ * under the License. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.analysis.common; import org.apache.lucene.analysis.CharArraySet; import org.apache.lucene.analysis.hu.HungarianAnalyzer; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.IndexSettings; +import org.elasticsearch.index.analysis.AbstractIndexAnalyzerProvider; +import org.elasticsearch.index.analysis.Analysis; public class HungarianAnalyzerProvider extends AbstractIndexAnalyzerProvider<HungarianAnalyzer> { private final HungarianAnalyzer analyzer; - public HungarianAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { + HungarianAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { super(indexSettings, name, settings); analyzer = new HungarianAnalyzer( Analysis.parseStopWords(env, indexSettings.getIndexVersionCreated(), settings, HungarianAnalyzer.getDefaultStopSet()), diff --git a/server/src/main/java/org/elasticsearch/index/analysis/IndonesianAnalyzerProvider.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/IndonesianAnalyzerProvider.java similarity index 85% rename from server/src/main/java/org/elasticsearch/index/analysis/IndonesianAnalyzerProvider.java rename to modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/IndonesianAnalyzerProvider.java index d5633025804e9..d20185deb4509 100644 --- a/server/src/main/java/org/elasticsearch/index/analysis/IndonesianAnalyzerProvider.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/IndonesianAnalyzerProvider.java @@ -17,19 +17,21 @@ * under the License. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.analysis.common; import org.apache.lucene.analysis.CharArraySet; import org.apache.lucene.analysis.id.IndonesianAnalyzer; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.IndexSettings; +import org.elasticsearch.index.analysis.AbstractIndexAnalyzerProvider; +import org.elasticsearch.index.analysis.Analysis; public class IndonesianAnalyzerProvider extends AbstractIndexAnalyzerProvider<IndonesianAnalyzer> { private final IndonesianAnalyzer analyzer; - public IndonesianAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { + IndonesianAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { super(indexSettings, name, settings); analyzer = new IndonesianAnalyzer( Analysis.parseStopWords(env, indexSettings.getIndexVersionCreated(), settings, IndonesianAnalyzer.getDefaultStopSet()), diff --git a/server/src/main/java/org/elasticsearch/index/analysis/IrishAnalyzerProvider.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/IrishAnalyzerProvider.java similarity index 85% rename from server/src/main/java/org/elasticsearch/index/analysis/IrishAnalyzerProvider.java rename to modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/IrishAnalyzerProvider.java index 69250df736052..dae7862b76bb6 100644 --- a/server/src/main/java/org/elasticsearch/index/analysis/IrishAnalyzerProvider.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/IrishAnalyzerProvider.java @@ -17,13 +17,15 @@ * under the License. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.analysis.common; import org.apache.lucene.analysis.CharArraySet; import org.apache.lucene.analysis.ga.IrishAnalyzer; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.IndexSettings; +import org.elasticsearch.index.analysis.AbstractIndexAnalyzerProvider; +import org.elasticsearch.index.analysis.Analysis; /** * Provider for {@link IrishAnalyzer} @@ -32,7 +34,7 @@ public class IrishAnalyzerProvider extends AbstractIndexAnalyzerProvider<IrishAn private final IrishAnalyzer analyzer; - public IrishAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { + IrishAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { super(indexSettings, name, settings); analyzer = new IrishAnalyzer( Analysis.parseStopWords(env, indexSettings.getIndexVersionCreated(), settings, IrishAnalyzer.getDefaultStopSet()), diff --git a/server/src/main/java/org/elasticsearch/index/analysis/ItalianAnalyzerProvider.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/ItalianAnalyzerProvider.java similarity index 85% rename from server/src/main/java/org/elasticsearch/index/analysis/ItalianAnalyzerProvider.java rename to modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/ItalianAnalyzerProvider.java index 7a9ae2d7ab436..38a9c6b2d9b03 100644 --- a/server/src/main/java/org/elasticsearch/index/analysis/ItalianAnalyzerProvider.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/ItalianAnalyzerProvider.java @@ -17,19 +17,21 @@ * under the License. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.analysis.common; import org.apache.lucene.analysis.CharArraySet; import org.apache.lucene.analysis.it.ItalianAnalyzer; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.IndexSettings; +import org.elasticsearch.index.analysis.AbstractIndexAnalyzerProvider; +import org.elasticsearch.index.analysis.Analysis; public class ItalianAnalyzerProvider extends AbstractIndexAnalyzerProvider<ItalianAnalyzer> { private final ItalianAnalyzer analyzer; - public ItalianAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { + ItalianAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { super(indexSettings, name, settings); analyzer = new ItalianAnalyzer( Analysis.parseStopWords(env, indexSettings.getIndexVersionCreated(), settings, ItalianAnalyzer.getDefaultStopSet()), diff --git a/server/src/main/java/org/elasticsearch/index/analysis/LatvianAnalyzerProvider.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/LatvianAnalyzerProvider.java similarity index 85% rename from server/src/main/java/org/elasticsearch/index/analysis/LatvianAnalyzerProvider.java rename to modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/LatvianAnalyzerProvider.java index a7731f352b997..668f91f6ea478 100644 --- a/server/src/main/java/org/elasticsearch/index/analysis/LatvianAnalyzerProvider.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/LatvianAnalyzerProvider.java @@ -17,19 +17,21 @@ * under the License. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.analysis.common; import org.apache.lucene.analysis.CharArraySet; import org.apache.lucene.analysis.lv.LatvianAnalyzer; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.IndexSettings; +import org.elasticsearch.index.analysis.AbstractIndexAnalyzerProvider; +import org.elasticsearch.index.analysis.Analysis; public class LatvianAnalyzerProvider extends AbstractIndexAnalyzerProvider<LatvianAnalyzer> { private final LatvianAnalyzer analyzer; - public LatvianAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { + LatvianAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { super(indexSettings, name, settings); analyzer = new LatvianAnalyzer( Analysis.parseStopWords(env, indexSettings.getIndexVersionCreated(), settings, LatvianAnalyzer.getDefaultStopSet()), diff --git a/server/src/main/java/org/elasticsearch/index/analysis/LithuanianAnalyzerProvider.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/LithuanianAnalyzerProvider.java similarity index 85% rename from server/src/main/java/org/elasticsearch/index/analysis/LithuanianAnalyzerProvider.java rename to modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/LithuanianAnalyzerProvider.java index 307904b89427f..8a355c9c3f8c8 100644 --- a/server/src/main/java/org/elasticsearch/index/analysis/LithuanianAnalyzerProvider.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/LithuanianAnalyzerProvider.java @@ -17,13 +17,15 @@ * under the License. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.analysis.common; import org.apache.lucene.analysis.CharArraySet; import org.apache.lucene.analysis.lt.LithuanianAnalyzer; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.IndexSettings; +import org.elasticsearch.index.analysis.AbstractIndexAnalyzerProvider; +import org.elasticsearch.index.analysis.Analysis; /** * Provider for {@link LithuanianAnalyzer} @@ -32,7 +34,7 @@ public class LithuanianAnalyzerProvider extends AbstractIndexAnalyzerProvider<Li private final LithuanianAnalyzer analyzer; - public LithuanianAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { + LithuanianAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { super(indexSettings, name, settings); analyzer = new LithuanianAnalyzer( Analysis.parseStopWords(env, indexSettings.getIndexVersionCreated(), settings, LithuanianAnalyzer.getDefaultStopSet()), diff --git a/server/src/main/java/org/elasticsearch/index/analysis/NorwegianAnalyzerProvider.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/NorwegianAnalyzerProvider.java similarity index 85% rename from server/src/main/java/org/elasticsearch/index/analysis/NorwegianAnalyzerProvider.java rename to modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/NorwegianAnalyzerProvider.java index ca7d898fb47c0..d713d5fea5dea 100644 --- a/server/src/main/java/org/elasticsearch/index/analysis/NorwegianAnalyzerProvider.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/NorwegianAnalyzerProvider.java @@ -17,19 +17,21 @@ * under the License. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.analysis.common; import org.apache.lucene.analysis.CharArraySet; import org.apache.lucene.analysis.no.NorwegianAnalyzer; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.IndexSettings; +import org.elasticsearch.index.analysis.AbstractIndexAnalyzerProvider; +import org.elasticsearch.index.analysis.Analysis; public class NorwegianAnalyzerProvider extends AbstractIndexAnalyzerProvider<NorwegianAnalyzer> { private final NorwegianAnalyzer analyzer; - public NorwegianAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { + NorwegianAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { super(indexSettings, name, settings); analyzer = new NorwegianAnalyzer( Analysis.parseStopWords(env, indexSettings.getIndexVersionCreated(), settings, NorwegianAnalyzer.getDefaultStopSet()), diff --git a/server/src/main/java/org/elasticsearch/index/analysis/PersianAnalyzerProvider.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/PersianAnalyzerProvider.java similarity index 84% rename from server/src/main/java/org/elasticsearch/index/analysis/PersianAnalyzerProvider.java rename to modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/PersianAnalyzerProvider.java index ed92e3e0c02d6..74c3a95a57766 100644 --- a/server/src/main/java/org/elasticsearch/index/analysis/PersianAnalyzerProvider.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/PersianAnalyzerProvider.java @@ -17,18 +17,20 @@ * under the License. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.analysis.common; import org.apache.lucene.analysis.fa.PersianAnalyzer; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.IndexSettings; +import org.elasticsearch.index.analysis.AbstractIndexAnalyzerProvider; +import org.elasticsearch.index.analysis.Analysis; public class PersianAnalyzerProvider extends AbstractIndexAnalyzerProvider<PersianAnalyzer> { private final PersianAnalyzer analyzer; - public PersianAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { + PersianAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { super(indexSettings, name, settings); analyzer = new PersianAnalyzer( Analysis.parseStopWords(env, indexSettings.getIndexVersionCreated(), settings, PersianAnalyzer.getDefaultStopSet())); diff --git a/server/src/main/java/org/elasticsearch/index/analysis/PortugueseAnalyzerProvider.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/PortugueseAnalyzerProvider.java similarity index 85% rename from server/src/main/java/org/elasticsearch/index/analysis/PortugueseAnalyzerProvider.java rename to modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/PortugueseAnalyzerProvider.java index 73dc016fe6965..aba9c9980c9e1 100644 --- a/server/src/main/java/org/elasticsearch/index/analysis/PortugueseAnalyzerProvider.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/PortugueseAnalyzerProvider.java @@ -17,19 +17,21 @@ * under the License. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.analysis.common; import org.apache.lucene.analysis.CharArraySet; import org.apache.lucene.analysis.pt.PortugueseAnalyzer; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.IndexSettings; +import org.elasticsearch.index.analysis.AbstractIndexAnalyzerProvider; +import org.elasticsearch.index.analysis.Analysis; public class PortugueseAnalyzerProvider extends AbstractIndexAnalyzerProvider<PortugueseAnalyzer> { private final PortugueseAnalyzer analyzer; - public PortugueseAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { + PortugueseAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { super(indexSettings, name, settings); analyzer = new PortugueseAnalyzer( Analysis.parseStopWords(env, indexSettings.getIndexVersionCreated(), settings, PortugueseAnalyzer.getDefaultStopSet()), diff --git a/server/src/main/java/org/elasticsearch/index/analysis/RomanianAnalyzerProvider.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/RomanianAnalyzerProvider.java similarity index 85% rename from server/src/main/java/org/elasticsearch/index/analysis/RomanianAnalyzerProvider.java rename to modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/RomanianAnalyzerProvider.java index 5eeb22f5118d2..f1ff399272c38 100644 --- a/server/src/main/java/org/elasticsearch/index/analysis/RomanianAnalyzerProvider.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/RomanianAnalyzerProvider.java @@ -17,19 +17,21 @@ * under the License. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.analysis.common; import org.apache.lucene.analysis.CharArraySet; import org.apache.lucene.analysis.ro.RomanianAnalyzer; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.IndexSettings; +import org.elasticsearch.index.analysis.AbstractIndexAnalyzerProvider; +import org.elasticsearch.index.analysis.Analysis; public class RomanianAnalyzerProvider extends AbstractIndexAnalyzerProvider<RomanianAnalyzer> { private final RomanianAnalyzer analyzer; - public RomanianAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { + RomanianAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { super(indexSettings, name, settings); analyzer = new RomanianAnalyzer( Analysis.parseStopWords(env, indexSettings.getIndexVersionCreated(), settings, RomanianAnalyzer.getDefaultStopSet()), diff --git a/server/src/main/java/org/elasticsearch/index/analysis/RussianAnalyzerProvider.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/RussianAnalyzerProvider.java similarity index 85% rename from server/src/main/java/org/elasticsearch/index/analysis/RussianAnalyzerProvider.java rename to modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/RussianAnalyzerProvider.java index 6e57603794cd2..2d20398a7fff8 100644 --- a/server/src/main/java/org/elasticsearch/index/analysis/RussianAnalyzerProvider.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/RussianAnalyzerProvider.java @@ -17,19 +17,21 @@ * under the License. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.analysis.common; import org.apache.lucene.analysis.CharArraySet; import org.apache.lucene.analysis.ru.RussianAnalyzer; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.IndexSettings; +import org.elasticsearch.index.analysis.AbstractIndexAnalyzerProvider; +import org.elasticsearch.index.analysis.Analysis; public class RussianAnalyzerProvider extends AbstractIndexAnalyzerProvider<RussianAnalyzer> { private final RussianAnalyzer analyzer; - public RussianAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { + RussianAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { super(indexSettings, name, settings); analyzer = new RussianAnalyzer( Analysis.parseStopWords(env, indexSettings.getIndexVersionCreated(), settings, RussianAnalyzer.getDefaultStopSet()), diff --git a/server/src/main/java/org/elasticsearch/index/analysis/SoraniAnalyzerProvider.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/SoraniAnalyzerProvider.java similarity index 85% rename from server/src/main/java/org/elasticsearch/index/analysis/SoraniAnalyzerProvider.java rename to modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/SoraniAnalyzerProvider.java index d3b9fcd3f5c47..e2f565a7ec560 100644 --- a/server/src/main/java/org/elasticsearch/index/analysis/SoraniAnalyzerProvider.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/SoraniAnalyzerProvider.java @@ -17,13 +17,15 @@ * under the License. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.analysis.common; import org.apache.lucene.analysis.CharArraySet; import org.apache.lucene.analysis.ckb.SoraniAnalyzer; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.IndexSettings; +import org.elasticsearch.index.analysis.AbstractIndexAnalyzerProvider; +import org.elasticsearch.index.analysis.Analysis; /** * Provider for {@link SoraniAnalyzer} @@ -32,7 +34,7 @@ public class SoraniAnalyzerProvider extends AbstractIndexAnalyzerProvider<Sorani private final SoraniAnalyzer analyzer; - public SoraniAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { + SoraniAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { super(indexSettings, name, settings); analyzer = new SoraniAnalyzer( Analysis.parseStopWords(env, indexSettings.getIndexVersionCreated(), settings, SoraniAnalyzer.getDefaultStopSet()), diff --git a/server/src/main/java/org/elasticsearch/index/analysis/SpanishAnalyzerProvider.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/SpanishAnalyzerProvider.java similarity index 85% rename from server/src/main/java/org/elasticsearch/index/analysis/SpanishAnalyzerProvider.java rename to modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/SpanishAnalyzerProvider.java index a32d9a0f3ca01..44fa36e0029b5 100644 --- a/server/src/main/java/org/elasticsearch/index/analysis/SpanishAnalyzerProvider.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/SpanishAnalyzerProvider.java @@ -17,19 +17,21 @@ * under the License. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.analysis.common; import org.apache.lucene.analysis.CharArraySet; import org.apache.lucene.analysis.es.SpanishAnalyzer; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.IndexSettings; +import org.elasticsearch.index.analysis.AbstractIndexAnalyzerProvider; +import org.elasticsearch.index.analysis.Analysis; public class SpanishAnalyzerProvider extends AbstractIndexAnalyzerProvider<SpanishAnalyzer> { private final SpanishAnalyzer analyzer; - public SpanishAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { + SpanishAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { super(indexSettings, name, settings); analyzer = new SpanishAnalyzer( Analysis.parseStopWords(env, indexSettings.getIndexVersionCreated(), settings, SpanishAnalyzer.getDefaultStopSet()), diff --git a/server/src/main/java/org/elasticsearch/index/analysis/SwedishAnalyzerProvider.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/SwedishAnalyzerProvider.java similarity index 85% rename from server/src/main/java/org/elasticsearch/index/analysis/SwedishAnalyzerProvider.java rename to modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/SwedishAnalyzerProvider.java index 066d2eef78bd1..3fb3279e79a3e 100644 --- a/server/src/main/java/org/elasticsearch/index/analysis/SwedishAnalyzerProvider.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/SwedishAnalyzerProvider.java @@ -17,19 +17,21 @@ * under the License. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.analysis.common; import org.apache.lucene.analysis.CharArraySet; import org.apache.lucene.analysis.sv.SwedishAnalyzer; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.IndexSettings; +import org.elasticsearch.index.analysis.AbstractIndexAnalyzerProvider; +import org.elasticsearch.index.analysis.Analysis; public class SwedishAnalyzerProvider extends AbstractIndexAnalyzerProvider<SwedishAnalyzer> { private final SwedishAnalyzer analyzer; - public SwedishAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { + SwedishAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { super(indexSettings, name, settings); analyzer = new SwedishAnalyzer( Analysis.parseStopWords(env, indexSettings.getIndexVersionCreated(), settings, SwedishAnalyzer.getDefaultStopSet()), diff --git a/server/src/main/java/org/elasticsearch/index/analysis/ThaiAnalyzerProvider.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/ThaiAnalyzerProvider.java similarity index 84% rename from server/src/main/java/org/elasticsearch/index/analysis/ThaiAnalyzerProvider.java rename to modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/ThaiAnalyzerProvider.java index 119eb81d7482d..9d53659d662bc 100644 --- a/server/src/main/java/org/elasticsearch/index/analysis/ThaiAnalyzerProvider.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/ThaiAnalyzerProvider.java @@ -17,18 +17,20 @@ * under the License. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.analysis.common; import org.apache.lucene.analysis.th.ThaiAnalyzer; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.IndexSettings; +import org.elasticsearch.index.analysis.AbstractIndexAnalyzerProvider; +import org.elasticsearch.index.analysis.Analysis; public class ThaiAnalyzerProvider extends AbstractIndexAnalyzerProvider<ThaiAnalyzer> { private final ThaiAnalyzer analyzer; - public ThaiAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { + ThaiAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { super(indexSettings, name, settings); analyzer = new ThaiAnalyzer( Analysis.parseStopWords(env, indexSettings.getIndexVersionCreated(), settings, ThaiAnalyzer.getDefaultStopSet())); diff --git a/server/src/main/java/org/elasticsearch/index/analysis/TurkishAnalyzerProvider.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/TurkishAnalyzerProvider.java similarity index 85% rename from server/src/main/java/org/elasticsearch/index/analysis/TurkishAnalyzerProvider.java rename to modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/TurkishAnalyzerProvider.java index 0eaf49afdc82f..10df3b2baab49 100644 --- a/server/src/main/java/org/elasticsearch/index/analysis/TurkishAnalyzerProvider.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/TurkishAnalyzerProvider.java @@ -17,19 +17,21 @@ * under the License. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.analysis.common; import org.apache.lucene.analysis.CharArraySet; import org.apache.lucene.analysis.tr.TurkishAnalyzer; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.IndexSettings; +import org.elasticsearch.index.analysis.AbstractIndexAnalyzerProvider; +import org.elasticsearch.index.analysis.Analysis; public class TurkishAnalyzerProvider extends AbstractIndexAnalyzerProvider<TurkishAnalyzer> { private final TurkishAnalyzer analyzer; - public TurkishAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { + TurkishAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { super(indexSettings, name, settings); analyzer = new TurkishAnalyzer( Analysis.parseStopWords(env, indexSettings.getIndexVersionCreated(), settings, TurkishAnalyzer.getDefaultStopSet()), diff --git a/modules/analysis-common/src/test/resources/rest-api-spec/test/analysis-common/20_analyzers.yml b/modules/analysis-common/src/test/resources/rest-api-spec/test/analysis-common/20_analyzers.yml index fa0476c0f11aa..fa8f6eef8b924 100644 --- a/modules/analysis-common/src/test/resources/rest-api-spec/test/analysis-common/20_analyzers.yml +++ b/modules/analysis-common/src/test/resources/rest-api-spec/test/analysis-common/20_analyzers.yml @@ -592,3 +592,525 @@ analyzer: my_analyzer - length: { tokens: 1 } - match: { tokens.0.token: tisch } + +--- +"greek": + - do: + indices.create: + index: test + body: + settings: + analysis: + analyzer: + my_analyzer: + type: greek + + - do: + indices.analyze: + body: + text: Μία + analyzer: greek + - length: { tokens: 1 } + - match: { tokens.0.token: μια } + + - do: + indices.analyze: + index: test + body: + text: Μία + analyzer: my_analyzer + - length: { tokens: 1 } + - match: { tokens.0.token: μια } + +--- +"hindi": + - do: + indices.create: + index: test + body: + settings: + analysis: + analyzer: + my_analyzer: + type: hindi + + - do: + indices.analyze: + body: + text: हिन्दी + analyzer: hindi + - length: { tokens: 1 } + - match: { tokens.0.token: हिंद } + + - do: + indices.analyze: + index: test + body: + text: हिन्दी + analyzer: my_analyzer + - length: { tokens: 1 } + - match: { tokens.0.token: हिंद } + +--- +"hungarian": + - do: + indices.create: + index: test + body: + settings: + analysis: + analyzer: + my_analyzer: + type: hungarian + + - do: + indices.analyze: + body: + text: babakocsi + analyzer: hungarian + - length: { tokens: 1 } + - match: { tokens.0.token: babakocs } + + - do: + indices.analyze: + index: test + body: + text: babakocsi + analyzer: my_analyzer + - length: { tokens: 1 } + - match: { tokens.0.token: babakocs } + +--- +"indonesian": + - do: + indices.create: + index: test + body: + settings: + analysis: + analyzer: + my_analyzer: + type: indonesian + + - do: + indices.analyze: + body: + text: peledakan + analyzer: indonesian + - length: { tokens: 1 } + - match: { tokens.0.token: ledak } + + - do: + indices.analyze: + index: test + body: + text: peledakan + analyzer: my_analyzer + - length: { tokens: 1 } + - match: { tokens.0.token: ledak } + +--- +"irish": + - do: + indices.create: + index: test + body: + settings: + analysis: + analyzer: + my_analyzer: + type: irish + + - do: + indices.analyze: + body: + text: siopadóireacht + analyzer: irish + - length: { tokens: 1 } + - match: { tokens.0.token: siopadóir } + + - do: + indices.analyze: + index: test + body: + text: siopadóireacht + analyzer: my_analyzer + - length: { tokens: 1 } + - match: { tokens.0.token: siopadóir } + +--- +"italian": + - do: + indices.create: + index: test + body: + settings: + analysis: + analyzer: + my_analyzer: + type: italian + + - do: + indices.analyze: + body: + text: abbandonata + analyzer: italian + - length: { tokens: 1 } + - match: { tokens.0.token: abbandonat } + + - do: + indices.analyze: + index: test + body: + text: abbandonata + analyzer: my_analyzer + - length: { tokens: 1 } + - match: { tokens.0.token: abbandonat } + +--- +"latvian": + - do: + indices.create: + index: test + body: + settings: + analysis: + analyzer: + my_analyzer: + type: latvian + + - do: + indices.analyze: + body: + text: tirgiem + analyzer: latvian + - length: { tokens: 1 } + - match: { tokens.0.token: tirg } + + - do: + indices.analyze: + index: test + body: + text: tirgiem + analyzer: my_analyzer + - length: { tokens: 1 } + - match: { tokens.0.token: tirg } + +--- +"lithuanian": + - do: + indices.create: + index: test + body: + settings: + analysis: + analyzer: + my_analyzer: + type: lithuanian + + - do: + indices.analyze: + body: + text: vaikų + analyzer: lithuanian + - length: { tokens: 1 } + - match: { tokens.0.token: vaik } + + - do: + indices.analyze: + index: test + body: + text: vaikų + analyzer: my_analyzer + - length: { tokens: 1 } + - match: { tokens.0.token: vaik } + +--- +"norwegian": + - do: + indices.create: + index: test + body: + settings: + analysis: + analyzer: + my_analyzer: + type: norwegian + + - do: + indices.analyze: + body: + text: havnedistriktene + analyzer: norwegian + - length: { tokens: 1 } + - match: { tokens.0.token: havnedistrikt } + + - do: + indices.analyze: + index: test + body: + text: havnedistriktene + analyzer: my_analyzer + - length: { tokens: 1 } + - match: { tokens.0.token: havnedistrikt } + +--- +"persian": + - do: + indices.create: + index: test + body: + settings: + analysis: + analyzer: + my_analyzer: + type: persian + + - do: + indices.analyze: + body: + text: میخورد + analyzer: persian + - length: { tokens: 1 } + - match: { tokens.0.token: خورد } + + - do: + indices.analyze: + index: test + body: + text: میخورد + analyzer: my_analyzer + - length: { tokens: 1 } + - match: { tokens.0.token: خورد } + +--- +"portuguese": + - do: + indices.create: + index: test + body: + settings: + analysis: + analyzer: + my_analyzer: + type: portuguese + + - do: + indices.analyze: + body: + text: quilométricas + analyzer: portuguese + - length: { tokens: 1 } + - match: { tokens.0.token: quilometric } + + - do: + indices.analyze: + index: test + body: + text: quilométricas + analyzer: my_analyzer + - length: { tokens: 1 } + - match: { tokens.0.token: quilometric } + +--- +"romanian": + - do: + indices.create: + index: test + body: + settings: + analysis: + analyzer: + my_analyzer: + type: romanian + + - do: + indices.analyze: + body: + text: absenţa + analyzer: romanian + - length: { tokens: 1 } + - match: { tokens.0.token: absenţ } + + - do: + indices.analyze: + index: test + body: + text: absenţa + analyzer: my_analyzer + - length: { tokens: 1 } + - match: { tokens.0.token: absenţ } + +--- +"russian": + - do: + indices.create: + index: test + body: + settings: + analysis: + analyzer: + my_analyzer: + type: russian + + - do: + indices.analyze: + body: + text: Вместе с тем о + analyzer: russian + - length: { tokens: 1 } + - match: { tokens.0.token: вмест } + + - do: + indices.analyze: + index: test + body: + text: Вместе с тем о + analyzer: my_analyzer + - length: { tokens: 1 } + - match: { tokens.0.token: вмест } + +--- +"sorani": + - do: + indices.create: + index: test + body: + settings: + analysis: + analyzer: + my_analyzer: + type: sorani + + - do: + indices.analyze: + body: + text: پیاوە + analyzer: sorani + - length: { tokens: 1 } + - match: { tokens.0.token: پیاو } + + - do: + indices.analyze: + index: test + body: + text: پیاوە + analyzer: my_analyzer + - length: { tokens: 1 } + - match: { tokens.0.token: پیاو } + +--- +"spanish": + - do: + indices.create: + index: test + body: + settings: + analysis: + analyzer: + my_analyzer: + type: spanish + + - do: + indices.analyze: + body: + text: chicana + analyzer: spanish + - length: { tokens: 1 } + - match: { tokens.0.token: chican } + + - do: + indices.analyze: + index: test + body: + text: chicana + analyzer: my_analyzer + - length: { tokens: 1 } + - match: { tokens.0.token: chican } + +--- +"swedish": + - do: + indices.create: + index: test + body: + settings: + analysis: + analyzer: + my_analyzer: + type: swedish + + - do: + indices.analyze: + body: + text: jaktkarlarne + analyzer: swedish + - length: { tokens: 1 } + - match: { tokens.0.token: jaktkarl } + + - do: + indices.analyze: + index: test + body: + text: jaktkarlarne + analyzer: my_analyzer + - length: { tokens: 1 } + - match: { tokens.0.token: jaktkarl } + +--- +"turkish": + - do: + indices.create: + index: test + body: + settings: + analysis: + analyzer: + my_analyzer: + type: turkish + + - do: + indices.analyze: + body: + text: ağacı + analyzer: turkish + - length: { tokens: 1 } + - match: { tokens.0.token: ağaç } + + - do: + indices.analyze: + index: test + body: + text: ağacı + analyzer: my_analyzer + - length: { tokens: 1 } + - match: { tokens.0.token: ağaç } + +--- +"thai": + - do: + indices.create: + index: test + body: + settings: + analysis: + analyzer: + my_analyzer: + type: thai + + - do: + indices.analyze: + body: + text: ๑๒๓๔ + analyzer: thai + - length: { tokens: 1 } + - match: { tokens.0.token: "1234" } + + - do: + indices.analyze: + index: test + body: + text: ๑๒๓๔ + analyzer: my_analyzer + - length: { tokens: 1 } + - match: { tokens.0.token: "1234" } diff --git a/server/src/main/java/org/elasticsearch/indices/analysis/AnalysisModule.java b/server/src/main/java/org/elasticsearch/indices/analysis/AnalysisModule.java index 6b7860c0cf949..364732dc1833d 100644 --- a/server/src/main/java/org/elasticsearch/indices/analysis/AnalysisModule.java +++ b/server/src/main/java/org/elasticsearch/indices/analysis/AnalysisModule.java @@ -30,39 +30,21 @@ import org.elasticsearch.index.analysis.AnalysisRegistry; import org.elasticsearch.index.analysis.AnalyzerProvider; import org.elasticsearch.index.analysis.CharFilterFactory; -import org.elasticsearch.index.analysis.GreekAnalyzerProvider; -import org.elasticsearch.index.analysis.HindiAnalyzerProvider; -import org.elasticsearch.index.analysis.HungarianAnalyzerProvider; import org.elasticsearch.index.analysis.HunspellTokenFilterFactory; -import org.elasticsearch.index.analysis.IndonesianAnalyzerProvider; -import org.elasticsearch.index.analysis.IrishAnalyzerProvider; -import org.elasticsearch.index.analysis.ItalianAnalyzerProvider; import org.elasticsearch.index.analysis.KeywordAnalyzerProvider; -import org.elasticsearch.index.analysis.LatvianAnalyzerProvider; -import org.elasticsearch.index.analysis.LithuanianAnalyzerProvider; -import org.elasticsearch.index.analysis.NorwegianAnalyzerProvider; -import org.elasticsearch.index.analysis.PersianAnalyzerProvider; -import org.elasticsearch.index.analysis.PortugueseAnalyzerProvider; import org.elasticsearch.index.analysis.PreBuiltAnalyzerProviderFactory; import org.elasticsearch.index.analysis.PreConfiguredCharFilter; import org.elasticsearch.index.analysis.PreConfiguredTokenFilter; import org.elasticsearch.index.analysis.PreConfiguredTokenizer; -import org.elasticsearch.index.analysis.RomanianAnalyzerProvider; -import org.elasticsearch.index.analysis.RussianAnalyzerProvider; import org.elasticsearch.index.analysis.ShingleTokenFilterFactory; import org.elasticsearch.index.analysis.SimpleAnalyzerProvider; -import org.elasticsearch.index.analysis.SoraniAnalyzerProvider; -import org.elasticsearch.index.analysis.SpanishAnalyzerProvider; import org.elasticsearch.index.analysis.StandardAnalyzerProvider; import org.elasticsearch.index.analysis.StandardTokenFilterFactory; import org.elasticsearch.index.analysis.StandardTokenizerFactory; import org.elasticsearch.index.analysis.StopAnalyzerProvider; import org.elasticsearch.index.analysis.StopTokenFilterFactory; -import org.elasticsearch.index.analysis.SwedishAnalyzerProvider; -import org.elasticsearch.index.analysis.ThaiAnalyzerProvider; import org.elasticsearch.index.analysis.TokenFilterFactory; import org.elasticsearch.index.analysis.TokenizerFactory; -import org.elasticsearch.index.analysis.TurkishAnalyzerProvider; import org.elasticsearch.index.analysis.WhitespaceAnalyzerProvider; import org.elasticsearch.plugins.AnalysisPlugin; @@ -227,24 +209,6 @@ private NamedRegistry<AnalysisProvider<AnalyzerProvider<?>>> setupAnalyzers(List analyzers.register("stop", StopAnalyzerProvider::new); analyzers.register("whitespace", WhitespaceAnalyzerProvider::new); analyzers.register("keyword", KeywordAnalyzerProvider::new); - analyzers.register("greek", GreekAnalyzerProvider::new); - analyzers.register("hindi", HindiAnalyzerProvider::new); - analyzers.register("hungarian", HungarianAnalyzerProvider::new); - analyzers.register("indonesian", IndonesianAnalyzerProvider::new); - analyzers.register("irish", IrishAnalyzerProvider::new); - analyzers.register("italian", ItalianAnalyzerProvider::new); - analyzers.register("latvian", LatvianAnalyzerProvider::new); - analyzers.register("lithuanian", LithuanianAnalyzerProvider::new); - analyzers.register("norwegian", NorwegianAnalyzerProvider::new); - analyzers.register("persian", PersianAnalyzerProvider::new); - analyzers.register("portuguese", PortugueseAnalyzerProvider::new); - analyzers.register("romanian", RomanianAnalyzerProvider::new); - analyzers.register("russian", RussianAnalyzerProvider::new); - analyzers.register("sorani", SoraniAnalyzerProvider::new); - analyzers.register("spanish", SpanishAnalyzerProvider::new); - analyzers.register("swedish", SwedishAnalyzerProvider::new); - analyzers.register("turkish", TurkishAnalyzerProvider::new); - analyzers.register("thai", ThaiAnalyzerProvider::new); analyzers.extractAndRegister(plugins, AnalysisPlugin::getAnalyzers); return analyzers; } diff --git a/server/src/main/java/org/elasticsearch/indices/analysis/PreBuiltAnalyzers.java b/server/src/main/java/org/elasticsearch/indices/analysis/PreBuiltAnalyzers.java index 0e9aed3c142d9..0f31a8a46f1db 100644 --- a/server/src/main/java/org/elasticsearch/indices/analysis/PreBuiltAnalyzers.java +++ b/server/src/main/java/org/elasticsearch/indices/analysis/PreBuiltAnalyzers.java @@ -20,30 +20,12 @@ import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.CharArraySet; -import org.apache.lucene.analysis.ckb.SoraniAnalyzer; import org.apache.lucene.analysis.core.KeywordAnalyzer; import org.apache.lucene.analysis.core.SimpleAnalyzer; import org.apache.lucene.analysis.core.StopAnalyzer; import org.apache.lucene.analysis.core.WhitespaceAnalyzer; -import org.apache.lucene.analysis.el.GreekAnalyzer; -import org.apache.lucene.analysis.es.SpanishAnalyzer; -import org.apache.lucene.analysis.fa.PersianAnalyzer; -import org.apache.lucene.analysis.ga.IrishAnalyzer; -import org.apache.lucene.analysis.hi.HindiAnalyzer; -import org.apache.lucene.analysis.hu.HungarianAnalyzer; -import org.apache.lucene.analysis.id.IndonesianAnalyzer; -import org.apache.lucene.analysis.it.ItalianAnalyzer; -import org.apache.lucene.analysis.lt.LithuanianAnalyzer; -import org.apache.lucene.analysis.lv.LatvianAnalyzer; -import org.apache.lucene.analysis.no.NorwegianAnalyzer; -import org.apache.lucene.analysis.pt.PortugueseAnalyzer; -import org.apache.lucene.analysis.ro.RomanianAnalyzer; -import org.apache.lucene.analysis.ru.RussianAnalyzer; import org.apache.lucene.analysis.standard.ClassicAnalyzer; import org.apache.lucene.analysis.standard.StandardAnalyzer; -import org.apache.lucene.analysis.sv.SwedishAnalyzer; -import org.apache.lucene.analysis.th.ThaiAnalyzer; -import org.apache.lucene.analysis.tr.TurkishAnalyzer; import org.elasticsearch.Version; import org.elasticsearch.indices.analysis.PreBuiltCacheFactory.CachingStrategy; @@ -110,168 +92,6 @@ protected Analyzer create(Version version) { a.setVersion(version.luceneVersion); return a; } - }, - - GREEK { - @Override - protected Analyzer create(Version version) { - Analyzer a = new GreekAnalyzer(); - a.setVersion(version.luceneVersion); - return a; - } - }, - - HINDI { - @Override - protected Analyzer create(Version version) { - Analyzer a = new HindiAnalyzer(); - a.setVersion(version.luceneVersion); - return a; - } - }, - - HUNGARIAN { - @Override - protected Analyzer create(Version version) { - Analyzer a = new HungarianAnalyzer(); - a.setVersion(version.luceneVersion); - return a; - } - }, - - INDONESIAN { - @Override - protected Analyzer create(Version version) { - Analyzer a = new IndonesianAnalyzer(); - a.setVersion(version.luceneVersion); - return a; - } - }, - - IRISH { - @Override - protected Analyzer create(Version version) { - Analyzer a = new IrishAnalyzer(); - a.setVersion(version.luceneVersion); - return a; - } - }, - - ITALIAN { - @Override - protected Analyzer create(Version version) { - Analyzer a = new ItalianAnalyzer(); - a.setVersion(version.luceneVersion); - return a; - } - }, - - LATVIAN { - @Override - protected Analyzer create(Version version) { - Analyzer a = new LatvianAnalyzer(); - a.setVersion(version.luceneVersion); - return a; - } - }, - - LITHUANIAN { - @Override - protected Analyzer create(Version version) { - Analyzer a = new LithuanianAnalyzer(); - a.setVersion(version.luceneVersion); - return a; - } - }, - - NORWEGIAN { - @Override - protected Analyzer create(Version version) { - Analyzer a = new NorwegianAnalyzer(); - a.setVersion(version.luceneVersion); - return a; - } - }, - - PERSIAN { - @Override - protected Analyzer create(Version version) { - Analyzer a = new PersianAnalyzer(); - a.setVersion(version.luceneVersion); - return a; - } - }, - - PORTUGUESE { - @Override - protected Analyzer create(Version version) { - Analyzer a = new PortugueseAnalyzer(); - a.setVersion(version.luceneVersion); - return a; - } - }, - - ROMANIAN { - @Override - protected Analyzer create(Version version) { - Analyzer a = new RomanianAnalyzer(); - a.setVersion(version.luceneVersion); - return a; - } - }, - - RUSSIAN { - @Override - protected Analyzer create(Version version) { - Analyzer a = new RussianAnalyzer(); - a.setVersion(version.luceneVersion); - return a; - } - }, - - SORANI { - @Override - protected Analyzer create(Version version) { - Analyzer a = new SoraniAnalyzer(); - a.setVersion(version.luceneVersion); - return a; - } - }, - - SPANISH { - @Override - protected Analyzer create(Version version) { - Analyzer a = new SpanishAnalyzer(); - a.setVersion(version.luceneVersion); - return a; - } - }, - - SWEDISH { - @Override - protected Analyzer create(Version version) { - Analyzer a = new SwedishAnalyzer(); - a.setVersion(version.luceneVersion); - return a; - } - }, - - TURKISH { - @Override - protected Analyzer create(Version version) { - Analyzer a = new TurkishAnalyzer(); - a.setVersion(version.luceneVersion); - return a; - } - }, - - THAI { - @Override - protected Analyzer create(Version version) { - Analyzer a = new ThaiAnalyzer(); - a.setVersion(version.luceneVersion); - return a; - } }; protected abstract Analyzer create(Version version); diff --git a/server/src/test/java/org/elasticsearch/indices/analysis/AnalysisModuleTests.java b/server/src/test/java/org/elasticsearch/indices/analysis/AnalysisModuleTests.java index b4a07e10675ca..3e6b11f56a1b2 100644 --- a/server/src/test/java/org/elasticsearch/indices/analysis/AnalysisModuleTests.java +++ b/server/src/test/java/org/elasticsearch/indices/analysis/AnalysisModuleTests.java @@ -165,7 +165,7 @@ public void testVersionedAnalyzers() throws Exception { assertEquals(Version.V_5_0_0.luceneVersion, indexAnalyzers.get("standard").analyzer().getVersion()); assertEquals(Version.V_5_0_0.luceneVersion, - indexAnalyzers.get("thai").analyzer().getVersion()); + indexAnalyzers.get("stop").analyzer().getVersion()); assertThat(indexAnalyzers.get("custom7").analyzer(), is(instanceOf(StandardAnalyzer.class))); assertEquals(org.apache.lucene.util.Version.fromBits(3,6,0),