Analysis: All analysis components that accept stopwords to allow to load stopwords from a file, closes #919.
This commit is contained in:
parent
563ad625c0
commit
1b686d3c2b
|
@ -119,7 +119,7 @@ public class Analysis {
|
||||||
.put("_turkish_", TurkishAnalyzer.getDefaultStopSet())
|
.put("_turkish_", TurkishAnalyzer.getDefaultStopSet())
|
||||||
.immutableMap();
|
.immutableMap();
|
||||||
|
|
||||||
public static Set<?> parseStopWords(Settings settings, Set<?> defaultStopWords) {
|
public static Set<?> parseStopWords(Environment env, Settings settings, Set<?> defaultStopWords) {
|
||||||
String value = settings.get("stopwords");
|
String value = settings.get("stopwords");
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
if ("_none_".equals(value)) {
|
if ("_none_".equals(value)) {
|
||||||
|
@ -139,9 +139,21 @@ public class Analysis {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return setStopWords;
|
return setStopWords;
|
||||||
} else {
|
|
||||||
return defaultStopWords;
|
|
||||||
}
|
}
|
||||||
|
Set<String> pathLoadedStopWords = getWordList(env, settings, "stopwords");
|
||||||
|
if (pathLoadedStopWords != null) {
|
||||||
|
Set setStopWords = new HashSet<String>();
|
||||||
|
for (String stopWord : pathLoadedStopWords) {
|
||||||
|
if (namedStopWords.containsKey(stopWord)) {
|
||||||
|
setStopWords.addAll(namedStopWords.get(stopWord));
|
||||||
|
} else {
|
||||||
|
setStopWords.add(stopWord);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return setStopWords;
|
||||||
|
}
|
||||||
|
|
||||||
|
return defaultStopWords;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class AnalysisService extends AbstractIndexComponent implements Closeable
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!analyzerProviders.containsKey("default")) {
|
if (!analyzerProviders.containsKey("default")) {
|
||||||
analyzerProviders.put("default", new StandardAnalyzerProvider(index, indexSettings, "default", ImmutableSettings.Builder.EMPTY_SETTINGS));
|
analyzerProviders.put("default", new StandardAnalyzerProvider(index, indexSettings, null, "default", ImmutableSettings.Builder.EMPTY_SETTINGS));
|
||||||
}
|
}
|
||||||
if (!analyzerProviders.containsKey("default_index")) {
|
if (!analyzerProviders.containsKey("default_index")) {
|
||||||
analyzerProviders.put("default_index", analyzerProviders.get("default"));
|
analyzerProviders.put("default_index", analyzerProviders.get("default"));
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.lucene.analysis.ar.ArabicAnalyzer;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -34,10 +35,10 @@ public class ArabicAnalyzerProvider extends AbstractIndexAnalyzerProvider<Arabic
|
||||||
|
|
||||||
private final ArabicAnalyzer arabicAnalyzer;
|
private final ArabicAnalyzer arabicAnalyzer;
|
||||||
|
|
||||||
@Inject public ArabicAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public ArabicAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
arabicAnalyzer = new ArabicAnalyzer(version,
|
arabicAnalyzer = new ArabicAnalyzer(version,
|
||||||
Analysis.parseStopWords(settings, ArabicAnalyzer.getDefaultStopSet()),
|
Analysis.parseStopWords(env, settings, ArabicAnalyzer.getDefaultStopSet()),
|
||||||
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.lucene.analysis.hy.ArmenianAnalyzer;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -34,10 +35,10 @@ public class ArmenianAnalyzerProvider extends AbstractIndexAnalyzerProvider<Arme
|
||||||
|
|
||||||
private final ArmenianAnalyzer analyzer;
|
private final ArmenianAnalyzer analyzer;
|
||||||
|
|
||||||
@Inject public ArmenianAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public ArmenianAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
analyzer = new ArmenianAnalyzer(version,
|
analyzer = new ArmenianAnalyzer(version,
|
||||||
Analysis.parseStopWords(settings, ArmenianAnalyzer.getDefaultStopSet()),
|
Analysis.parseStopWords(env, settings, ArmenianAnalyzer.getDefaultStopSet()),
|
||||||
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.lucene.analysis.eu.BasqueAnalyzer;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -34,10 +35,10 @@ public class BasqueAnalyzerProvider extends AbstractIndexAnalyzerProvider<Basque
|
||||||
|
|
||||||
private final BasqueAnalyzer analyzer;
|
private final BasqueAnalyzer analyzer;
|
||||||
|
|
||||||
@Inject public BasqueAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public BasqueAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
analyzer = new BasqueAnalyzer(version,
|
analyzer = new BasqueAnalyzer(version,
|
||||||
Analysis.parseStopWords(settings, BasqueAnalyzer.getDefaultStopSet()),
|
Analysis.parseStopWords(env, settings, BasqueAnalyzer.getDefaultStopSet()),
|
||||||
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.lucene.analysis.br.BrazilianAnalyzer;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -34,10 +35,10 @@ public class BrazilianAnalyzerProvider extends AbstractIndexAnalyzerProvider<Bra
|
||||||
|
|
||||||
private final BrazilianAnalyzer analyzer;
|
private final BrazilianAnalyzer analyzer;
|
||||||
|
|
||||||
@Inject public BrazilianAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public BrazilianAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
analyzer = new BrazilianAnalyzer(version,
|
analyzer = new BrazilianAnalyzer(version,
|
||||||
Analysis.parseStopWords(settings, BrazilianAnalyzer.getDefaultStopSet()),
|
Analysis.parseStopWords(env, settings, BrazilianAnalyzer.getDefaultStopSet()),
|
||||||
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.lucene.analysis.bg.BulgarianAnalyzer;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -34,10 +35,10 @@ public class BulgarianAnalyzerProvider extends AbstractIndexAnalyzerProvider<Bul
|
||||||
|
|
||||||
private final BulgarianAnalyzer analyzer;
|
private final BulgarianAnalyzer analyzer;
|
||||||
|
|
||||||
@Inject public BulgarianAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public BulgarianAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
analyzer = new BulgarianAnalyzer(version,
|
analyzer = new BulgarianAnalyzer(version,
|
||||||
Analysis.parseStopWords(settings, BulgarianAnalyzer.getDefaultStopSet()),
|
Analysis.parseStopWords(env, settings, BulgarianAnalyzer.getDefaultStopSet()),
|
||||||
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.lucene.analysis.ca.CatalanAnalyzer;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -34,10 +35,10 @@ public class CatalanAnalyzerProvider extends AbstractIndexAnalyzerProvider<Catal
|
||||||
|
|
||||||
private final CatalanAnalyzer analyzer;
|
private final CatalanAnalyzer analyzer;
|
||||||
|
|
||||||
@Inject public CatalanAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public CatalanAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
analyzer = new CatalanAnalyzer(version,
|
analyzer = new CatalanAnalyzer(version,
|
||||||
Analysis.parseStopWords(settings, CatalanAnalyzer.getDefaultStopSet()),
|
Analysis.parseStopWords(env, settings, CatalanAnalyzer.getDefaultStopSet()),
|
||||||
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.apache.lucene.analysis.cjk.CJKAnalyzer;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -35,9 +36,9 @@ public class CjkAnalyzerProvider extends AbstractIndexAnalyzerProvider<CJKAnalyz
|
||||||
|
|
||||||
private final CJKAnalyzer analyzer;
|
private final CJKAnalyzer analyzer;
|
||||||
|
|
||||||
@Inject public CjkAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public CjkAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
Set<?> stopWords = Analysis.parseStopWords(settings, CJKAnalyzer.getDefaultStopSet());
|
Set<?> stopWords = Analysis.parseStopWords(env, settings, CJKAnalyzer.getDefaultStopSet());
|
||||||
|
|
||||||
analyzer = new CJKAnalyzer(version, stopWords);
|
analyzer = new CJKAnalyzer(version, stopWords);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.lucene.analysis.cz.CzechAnalyzer;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -34,10 +35,10 @@ public class CzechAnalyzerProvider extends AbstractIndexAnalyzerProvider<CzechAn
|
||||||
|
|
||||||
private final CzechAnalyzer analyzer;
|
private final CzechAnalyzer analyzer;
|
||||||
|
|
||||||
@Inject public CzechAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public CzechAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
analyzer = new CzechAnalyzer(version,
|
analyzer = new CzechAnalyzer(version,
|
||||||
Analysis.parseStopWords(settings, CzechAnalyzer.getDefaultStopSet()),
|
Analysis.parseStopWords(env, settings, CzechAnalyzer.getDefaultStopSet()),
|
||||||
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.lucene.analysis.da.DanishAnalyzer;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -34,10 +35,10 @@ public class DanishAnalyzerProvider extends AbstractIndexAnalyzerProvider<Danish
|
||||||
|
|
||||||
private final DanishAnalyzer analyzer;
|
private final DanishAnalyzer analyzer;
|
||||||
|
|
||||||
@Inject public DanishAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public DanishAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
analyzer = new DanishAnalyzer(version,
|
analyzer = new DanishAnalyzer(version,
|
||||||
Analysis.parseStopWords(settings, DanishAnalyzer.getDefaultStopSet()),
|
Analysis.parseStopWords(env, settings, DanishAnalyzer.getDefaultStopSet()),
|
||||||
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.lucene.analysis.nl.DutchAnalyzer;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -34,10 +35,10 @@ public class DutchAnalyzerProvider extends AbstractIndexAnalyzerProvider<DutchAn
|
||||||
|
|
||||||
private final DutchAnalyzer analyzer;
|
private final DutchAnalyzer analyzer;
|
||||||
|
|
||||||
@Inject public DutchAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public DutchAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
analyzer = new DutchAnalyzer(version,
|
analyzer = new DutchAnalyzer(version,
|
||||||
Analysis.parseStopWords(settings, DutchAnalyzer.getDefaultStopSet()),
|
Analysis.parseStopWords(env, settings, DutchAnalyzer.getDefaultStopSet()),
|
||||||
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.lucene.analysis.en.EnglishAnalyzer;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -34,10 +35,10 @@ public class EnglishAnalyzerProvider extends AbstractIndexAnalyzerProvider<Engli
|
||||||
|
|
||||||
private final EnglishAnalyzer analyzer;
|
private final EnglishAnalyzer analyzer;
|
||||||
|
|
||||||
@Inject public EnglishAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public EnglishAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
analyzer = new EnglishAnalyzer(version,
|
analyzer = new EnglishAnalyzer(version,
|
||||||
Analysis.parseStopWords(settings, EnglishAnalyzer.getDefaultStopSet()),
|
Analysis.parseStopWords(env, settings, EnglishAnalyzer.getDefaultStopSet()),
|
||||||
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.lucene.analysis.fi.FinnishAnalyzer;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -34,10 +35,10 @@ public class FinnishAnalyzerProvider extends AbstractIndexAnalyzerProvider<Finni
|
||||||
|
|
||||||
private final FinnishAnalyzer analyzer;
|
private final FinnishAnalyzer analyzer;
|
||||||
|
|
||||||
@Inject public FinnishAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public FinnishAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
analyzer = new FinnishAnalyzer(version,
|
analyzer = new FinnishAnalyzer(version,
|
||||||
Analysis.parseStopWords(settings, FinnishAnalyzer.getDefaultStopSet()),
|
Analysis.parseStopWords(env, settings, FinnishAnalyzer.getDefaultStopSet()),
|
||||||
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.lucene.analysis.fr.FrenchAnalyzer;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -34,10 +35,10 @@ public class FrenchAnalyzerProvider extends AbstractIndexAnalyzerProvider<French
|
||||||
|
|
||||||
private final FrenchAnalyzer analyzer;
|
private final FrenchAnalyzer analyzer;
|
||||||
|
|
||||||
@Inject public FrenchAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public FrenchAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
analyzer = new FrenchAnalyzer(version,
|
analyzer = new FrenchAnalyzer(version,
|
||||||
Analysis.parseStopWords(settings, FrenchAnalyzer.getDefaultStopSet()),
|
Analysis.parseStopWords(env, settings, FrenchAnalyzer.getDefaultStopSet()),
|
||||||
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.lucene.analysis.gl.GalicianAnalyzer;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -34,10 +35,10 @@ public class GalicianAnalyzerProvider extends AbstractIndexAnalyzerProvider<Gali
|
||||||
|
|
||||||
private final GalicianAnalyzer analyzer;
|
private final GalicianAnalyzer analyzer;
|
||||||
|
|
||||||
@Inject public GalicianAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public GalicianAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
analyzer = new GalicianAnalyzer(version,
|
analyzer = new GalicianAnalyzer(version,
|
||||||
Analysis.parseStopWords(settings, GalicianAnalyzer.getDefaultStopSet()),
|
Analysis.parseStopWords(env, settings, GalicianAnalyzer.getDefaultStopSet()),
|
||||||
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.lucene.analysis.de.GermanAnalyzer;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -34,10 +35,10 @@ public class GermanAnalyzerProvider extends AbstractIndexAnalyzerProvider<German
|
||||||
|
|
||||||
private final GermanAnalyzer analyzer;
|
private final GermanAnalyzer analyzer;
|
||||||
|
|
||||||
@Inject public GermanAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public GermanAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
analyzer = new GermanAnalyzer(version,
|
analyzer = new GermanAnalyzer(version,
|
||||||
Analysis.parseStopWords(settings, GermanAnalyzer.getDefaultStopSet()),
|
Analysis.parseStopWords(env, settings, GermanAnalyzer.getDefaultStopSet()),
|
||||||
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.apache.lucene.analysis.el.GreekAnalyzer;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -33,10 +34,10 @@ public class GreekAnalyzerProvider extends AbstractIndexAnalyzerProvider<GreekAn
|
||||||
|
|
||||||
private final GreekAnalyzer analyzer;
|
private final GreekAnalyzer analyzer;
|
||||||
|
|
||||||
@Inject public GreekAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public GreekAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
analyzer = new GreekAnalyzer(version,
|
analyzer = new GreekAnalyzer(version,
|
||||||
Analysis.parseStopWords(settings, GreekAnalyzer.getDefaultStopSet()));
|
Analysis.parseStopWords(env, settings, GreekAnalyzer.getDefaultStopSet()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public GreekAnalyzer get() {
|
@Override public GreekAnalyzer get() {
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.lucene.analysis.hi.HindiAnalyzer;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -34,10 +35,10 @@ public class HindiAnalyzerProvider extends AbstractIndexAnalyzerProvider<HindiAn
|
||||||
|
|
||||||
private final HindiAnalyzer analyzer;
|
private final HindiAnalyzer analyzer;
|
||||||
|
|
||||||
@Inject public HindiAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public HindiAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
analyzer = new HindiAnalyzer(version,
|
analyzer = new HindiAnalyzer(version,
|
||||||
Analysis.parseStopWords(settings, HindiAnalyzer.getDefaultStopSet()),
|
Analysis.parseStopWords(env, settings, HindiAnalyzer.getDefaultStopSet()),
|
||||||
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.lucene.analysis.hu.HungarianAnalyzer;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -34,10 +35,10 @@ public class HungarianAnalyzerProvider extends AbstractIndexAnalyzerProvider<Hun
|
||||||
|
|
||||||
private final HungarianAnalyzer analyzer;
|
private final HungarianAnalyzer analyzer;
|
||||||
|
|
||||||
@Inject public HungarianAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public HungarianAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
analyzer = new HungarianAnalyzer(version,
|
analyzer = new HungarianAnalyzer(version,
|
||||||
Analysis.parseStopWords(settings, HungarianAnalyzer.getDefaultStopSet()),
|
Analysis.parseStopWords(env, settings, HungarianAnalyzer.getDefaultStopSet()),
|
||||||
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.lucene.analysis.id.IndonesianAnalyzer;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -34,10 +35,10 @@ public class IndonesianAnalyzerProvider extends AbstractIndexAnalyzerProvider<In
|
||||||
|
|
||||||
private final IndonesianAnalyzer analyzer;
|
private final IndonesianAnalyzer analyzer;
|
||||||
|
|
||||||
@Inject public IndonesianAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public IndonesianAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
analyzer = new IndonesianAnalyzer(version,
|
analyzer = new IndonesianAnalyzer(version,
|
||||||
Analysis.parseStopWords(settings, IndonesianAnalyzer.getDefaultStopSet()),
|
Analysis.parseStopWords(env, settings, IndonesianAnalyzer.getDefaultStopSet()),
|
||||||
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.lucene.analysis.it.ItalianAnalyzer;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -34,10 +35,10 @@ public class ItalianAnalyzerProvider extends AbstractIndexAnalyzerProvider<Itali
|
||||||
|
|
||||||
private final ItalianAnalyzer analyzer;
|
private final ItalianAnalyzer analyzer;
|
||||||
|
|
||||||
@Inject public ItalianAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public ItalianAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
analyzer = new ItalianAnalyzer(version,
|
analyzer = new ItalianAnalyzer(version,
|
||||||
Analysis.parseStopWords(settings, ItalianAnalyzer.getDefaultStopSet()),
|
Analysis.parseStopWords(env, settings, ItalianAnalyzer.getDefaultStopSet()),
|
||||||
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.lucene.analysis.no.NorwegianAnalyzer;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -34,10 +35,10 @@ public class NorwegianAnalyzerProvider extends AbstractIndexAnalyzerProvider<Nor
|
||||||
|
|
||||||
private final NorwegianAnalyzer analyzer;
|
private final NorwegianAnalyzer analyzer;
|
||||||
|
|
||||||
@Inject public NorwegianAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public NorwegianAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
analyzer = new NorwegianAnalyzer(version,
|
analyzer = new NorwegianAnalyzer(version,
|
||||||
Analysis.parseStopWords(settings, NorwegianAnalyzer.getDefaultStopSet()),
|
Analysis.parseStopWords(env, settings, NorwegianAnalyzer.getDefaultStopSet()),
|
||||||
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.regex.Regex;
|
import org.elasticsearch.common.regex.Regex;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -39,12 +40,12 @@ public class PatternAnalyzerProvider extends AbstractIndexAnalyzerProvider<Patte
|
||||||
|
|
||||||
private final PatternAnalyzer analyzer;
|
private final PatternAnalyzer analyzer;
|
||||||
|
|
||||||
@Inject public PatternAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public PatternAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
|
|
||||||
boolean lowercase = settings.getAsBoolean("lowercase", true);
|
boolean lowercase = settings.getAsBoolean("lowercase", true);
|
||||||
|
|
||||||
Set<?> stopWords = Analysis.parseStopWords(settings, StopAnalyzer.ENGLISH_STOP_WORDS_SET);
|
Set<?> stopWords = Analysis.parseStopWords(env, settings, StopAnalyzer.ENGLISH_STOP_WORDS_SET);
|
||||||
|
|
||||||
String sPattern = settings.get("pattern", "\\W+" /*PatternAnalyzer.NON_WORD_PATTERN*/);
|
String sPattern = settings.get("pattern", "\\W+" /*PatternAnalyzer.NON_WORD_PATTERN*/);
|
||||||
if (sPattern == null) {
|
if (sPattern == null) {
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.apache.lucene.analysis.fa.PersianAnalyzer;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -33,10 +34,10 @@ public class PersianAnalyzerProvider extends AbstractIndexAnalyzerProvider<Persi
|
||||||
|
|
||||||
private final PersianAnalyzer analyzer;
|
private final PersianAnalyzer analyzer;
|
||||||
|
|
||||||
@Inject public PersianAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public PersianAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
analyzer = new PersianAnalyzer(version,
|
analyzer = new PersianAnalyzer(version,
|
||||||
Analysis.parseStopWords(settings, PersianAnalyzer.getDefaultStopSet()));
|
Analysis.parseStopWords(env, settings, PersianAnalyzer.getDefaultStopSet()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public PersianAnalyzer get() {
|
@Override public PersianAnalyzer get() {
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.lucene.analysis.pt.PortugueseAnalyzer;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -34,10 +35,10 @@ public class PortugueseAnalyzerProvider extends AbstractIndexAnalyzerProvider<Po
|
||||||
|
|
||||||
private final PortugueseAnalyzer analyzer;
|
private final PortugueseAnalyzer analyzer;
|
||||||
|
|
||||||
@Inject public PortugueseAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public PortugueseAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
analyzer = new PortugueseAnalyzer(version,
|
analyzer = new PortugueseAnalyzer(version,
|
||||||
Analysis.parseStopWords(settings, PortugueseAnalyzer.getDefaultStopSet()),
|
Analysis.parseStopWords(env, settings, PortugueseAnalyzer.getDefaultStopSet()),
|
||||||
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.lucene.analysis.ro.RomanianAnalyzer;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -34,10 +35,10 @@ public class RomanianAnalyzerProvider extends AbstractIndexAnalyzerProvider<Roma
|
||||||
|
|
||||||
private final RomanianAnalyzer analyzer;
|
private final RomanianAnalyzer analyzer;
|
||||||
|
|
||||||
@Inject public RomanianAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public RomanianAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
analyzer = new RomanianAnalyzer(version,
|
analyzer = new RomanianAnalyzer(version,
|
||||||
Analysis.parseStopWords(settings, RomanianAnalyzer.getDefaultStopSet()),
|
Analysis.parseStopWords(env, settings, RomanianAnalyzer.getDefaultStopSet()),
|
||||||
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.lucene.analysis.ru.RussianAnalyzer;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -34,10 +35,10 @@ public class RussianAnalyzerProvider extends AbstractIndexAnalyzerProvider<Russi
|
||||||
|
|
||||||
private final RussianAnalyzer analyzer;
|
private final RussianAnalyzer analyzer;
|
||||||
|
|
||||||
@Inject public RussianAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public RussianAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
analyzer = new RussianAnalyzer(version,
|
analyzer = new RussianAnalyzer(version,
|
||||||
Analysis.parseStopWords(settings, RussianAnalyzer.getDefaultStopSet()),
|
Analysis.parseStopWords(env, settings, RussianAnalyzer.getDefaultStopSet()),
|
||||||
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ import org.elasticsearch.common.collect.MapBuilder;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -61,12 +62,12 @@ public class SnowballAnalyzerProvider extends AbstractIndexAnalyzerProvider<Snow
|
||||||
|
|
||||||
private final SnowballAnalyzer analyzer;
|
private final SnowballAnalyzer analyzer;
|
||||||
|
|
||||||
@Inject public SnowballAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public SnowballAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
|
|
||||||
String language = settings.get("language", settings.get("name", "English"));
|
String language = settings.get("language", settings.get("name", "English"));
|
||||||
Set<?> defaultStopwords = defaultLanguageStopwords.containsKey(language) ? defaultLanguageStopwords.get(language) : ImmutableSet.<Set<?>>of();
|
Set<?> defaultStopwords = defaultLanguageStopwords.containsKey(language) ? defaultLanguageStopwords.get(language) : ImmutableSet.<Set<?>>of();
|
||||||
Set<?> stopWords = Analysis.parseStopWords(settings, defaultStopwords);
|
Set<?> stopWords = Analysis.parseStopWords(env, settings, defaultStopwords);
|
||||||
|
|
||||||
analyzer = new SnowballAnalyzer(version, language, stopWords);
|
analyzer = new SnowballAnalyzer(version, language, stopWords);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.lucene.analysis.es.SpanishAnalyzer;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -34,10 +35,10 @@ public class SpanishAnalyzerProvider extends AbstractIndexAnalyzerProvider<Spani
|
||||||
|
|
||||||
private final SpanishAnalyzer analyzer;
|
private final SpanishAnalyzer analyzer;
|
||||||
|
|
||||||
@Inject public SpanishAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public SpanishAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
analyzer = new SpanishAnalyzer(version,
|
analyzer = new SpanishAnalyzer(version,
|
||||||
Analysis.parseStopWords(settings, SpanishAnalyzer.getDefaultStopSet()),
|
Analysis.parseStopWords(env, settings, SpanishAnalyzer.getDefaultStopSet()),
|
||||||
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.lucene.analysis.standard.StandardAnalyzer;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -36,9 +37,9 @@ public class StandardAnalyzerProvider extends AbstractIndexAnalyzerProvider<Stan
|
||||||
|
|
||||||
private final StandardAnalyzer standardAnalyzer;
|
private final StandardAnalyzer standardAnalyzer;
|
||||||
|
|
||||||
@Inject public StandardAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public StandardAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
Set<?> stopWords = Analysis.parseStopWords(settings, StopAnalyzer.ENGLISH_STOP_WORDS_SET);
|
Set<?> stopWords = Analysis.parseStopWords(env, settings, StopAnalyzer.ENGLISH_STOP_WORDS_SET);
|
||||||
int maxTokenLength = settings.getAsInt("max_token_length", StandardAnalyzer.DEFAULT_MAX_TOKEN_LENGTH);
|
int maxTokenLength = settings.getAsInt("max_token_length", StandardAnalyzer.DEFAULT_MAX_TOKEN_LENGTH);
|
||||||
standardAnalyzer = new StandardAnalyzer(version, stopWords);
|
standardAnalyzer = new StandardAnalyzer(version, stopWords);
|
||||||
standardAnalyzer.setMaxTokenLength(maxTokenLength);
|
standardAnalyzer.setMaxTokenLength(maxTokenLength);
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.apache.lucene.analysis.StopAnalyzer;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -35,9 +36,9 @@ public class StopAnalyzerProvider extends AbstractIndexAnalyzerProvider<StopAnal
|
||||||
|
|
||||||
private final StopAnalyzer stopAnalyzer;
|
private final StopAnalyzer stopAnalyzer;
|
||||||
|
|
||||||
@Inject public StopAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public StopAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
Set<?> stopWords = Analysis.parseStopWords(settings, StopAnalyzer.ENGLISH_STOP_WORDS_SET);
|
Set<?> stopWords = Analysis.parseStopWords(env, settings, StopAnalyzer.ENGLISH_STOP_WORDS_SET);
|
||||||
this.stopAnalyzer = new StopAnalyzer(version, stopWords);
|
this.stopAnalyzer = new StopAnalyzer(version, stopWords);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.apache.lucene.analysis.TokenStream;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -39,9 +40,9 @@ public class StopTokenFilterFactory extends AbstractTokenFilterFactory {
|
||||||
|
|
||||||
private final boolean ignoreCase;
|
private final boolean ignoreCase;
|
||||||
|
|
||||||
@Inject public StopTokenFilterFactory(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public StopTokenFilterFactory(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
this.stopWords = Analysis.parseStopWords(settings, StopAnalyzer.ENGLISH_STOP_WORDS_SET);
|
this.stopWords = Analysis.parseStopWords(env, settings, StopAnalyzer.ENGLISH_STOP_WORDS_SET);
|
||||||
this.ignoreCase = settings.getAsBoolean("ignore_case", false);
|
this.ignoreCase = settings.getAsBoolean("ignore_case", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.lucene.analysis.sv.SwedishAnalyzer;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -34,10 +35,10 @@ public class SwedishAnalyzerProvider extends AbstractIndexAnalyzerProvider<Swedi
|
||||||
|
|
||||||
private final SwedishAnalyzer analyzer;
|
private final SwedishAnalyzer analyzer;
|
||||||
|
|
||||||
@Inject public SwedishAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public SwedishAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
analyzer = new SwedishAnalyzer(version,
|
analyzer = new SwedishAnalyzer(version,
|
||||||
Analysis.parseStopWords(settings, SwedishAnalyzer.getDefaultStopSet()),
|
Analysis.parseStopWords(env, settings, SwedishAnalyzer.getDefaultStopSet()),
|
||||||
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.lucene.analysis.tr.TurkishAnalyzer;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
@ -34,10 +35,10 @@ public class TurkishAnalyzerProvider extends AbstractIndexAnalyzerProvider<Turki
|
||||||
|
|
||||||
private final TurkishAnalyzer analyzer;
|
private final TurkishAnalyzer analyzer;
|
||||||
|
|
||||||
@Inject public TurkishAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
@Inject public TurkishAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
|
||||||
super(index, indexSettings, name, settings);
|
super(index, indexSettings, name, settings);
|
||||||
analyzer = new TurkishAnalyzer(version,
|
analyzer = new TurkishAnalyzer(version,
|
||||||
Analysis.parseStopWords(settings, TurkishAnalyzer.getDefaultStopSet()),
|
Analysis.parseStopWords(env, settings, TurkishAnalyzer.getDefaultStopSet()),
|
||||||
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue