environemnt -> environment
This commit is contained in:
parent
8045e51ff3
commit
37ff6af759
|
@ -57,7 +57,7 @@ public final class AnalysisRegistry implements Closeable {
|
||||||
private final Map<String, Analyzer> cachedAnalyzer = new ConcurrentHashMap<>();
|
private final Map<String, Analyzer> cachedAnalyzer = new ConcurrentHashMap<>();
|
||||||
private final PrebuiltAnalysis prebuiltAnalysis;
|
private final PrebuiltAnalysis prebuiltAnalysis;
|
||||||
private final HunspellService hunspellService;
|
private final HunspellService hunspellService;
|
||||||
private final Environment environemnt;
|
private final Environment environment;
|
||||||
|
|
||||||
public AnalysisRegistry(HunspellService hunspellService, Environment environment) {
|
public AnalysisRegistry(HunspellService hunspellService, Environment environment) {
|
||||||
this(hunspellService, environment, Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap());
|
this(hunspellService, environment, Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap());
|
||||||
|
@ -70,7 +70,7 @@ public final class AnalysisRegistry implements Closeable {
|
||||||
Map<String, AnalysisModule.AnalysisProvider<AnalyzerProvider>> analyzers) {
|
Map<String, AnalysisModule.AnalysisProvider<AnalyzerProvider>> analyzers) {
|
||||||
prebuiltAnalysis = new PrebuiltAnalysis();
|
prebuiltAnalysis = new PrebuiltAnalysis();
|
||||||
this.hunspellService = hunspellService;
|
this.hunspellService = hunspellService;
|
||||||
this.environemnt = environment;
|
this.environment = environment;
|
||||||
final Map<String, AnalysisModule.AnalysisProvider<CharFilterFactory>> charFilterBuilder = new HashMap<>(charFilters);
|
final Map<String, AnalysisModule.AnalysisProvider<CharFilterFactory>> charFilterBuilder = new HashMap<>(charFilters);
|
||||||
final Map<String, AnalysisModule.AnalysisProvider<TokenFilterFactory>> tokenFilterBuilder = new HashMap<>(tokenFilters);
|
final Map<String, AnalysisModule.AnalysisProvider<TokenFilterFactory>> tokenFilterBuilder = new HashMap<>(tokenFilters);
|
||||||
final Map<String, AnalysisModule.AnalysisProvider<TokenizerFactory>> tokenizerBuilder = new HashMap<>(tokenizers);
|
final Map<String, AnalysisModule.AnalysisProvider<TokenizerFactory>> tokenizerBuilder = new HashMap<>(tokenizers);
|
||||||
|
@ -115,13 +115,13 @@ public final class AnalysisRegistry implements Closeable {
|
||||||
AnalysisModule.AnalysisProvider<AnalyzerProvider> provider = analyzers.get(analyzer);
|
AnalysisModule.AnalysisProvider<AnalyzerProvider> provider = analyzers.get(analyzer);
|
||||||
return provider == null ? null : cachedAnalyzer.computeIfAbsent(analyzer, (key) -> {
|
return provider == null ? null : cachedAnalyzer.computeIfAbsent(analyzer, (key) -> {
|
||||||
try {
|
try {
|
||||||
return provider.get(environemnt, key).get();
|
return provider.get(environment, key).get();
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
throw new ElasticsearchException("failed to load analyzer for name " + key, ex);
|
throw new ElasticsearchException("failed to load analyzer for name " + key, ex);
|
||||||
}}
|
}}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return analyzerProvider.get(environemnt, analyzer).get();
|
return analyzerProvider.get(environment, analyzer).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -324,7 +324,7 @@ public final class AnalysisRegistry implements Closeable {
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
throw new IllegalArgumentException("Unknown " + toBuild + " type [" + typeName + "] for [" + name + "]");
|
throw new IllegalArgumentException("Unknown " + toBuild + " type [" + typeName + "] for [" + name + "]");
|
||||||
}
|
}
|
||||||
factory = type.get(settings, environemnt, name, currentSettings);
|
factory = type.get(settings, environment, name, currentSettings);
|
||||||
}
|
}
|
||||||
factories.put(name, factory);
|
factories.put(name, factory);
|
||||||
} else {
|
} else {
|
||||||
|
@ -335,7 +335,7 @@ public final class AnalysisRegistry implements Closeable {
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
throw new IllegalArgumentException("Unknown " + toBuild + " type [" + typeName + "] for [" + name + "]");
|
throw new IllegalArgumentException("Unknown " + toBuild + " type [" + typeName + "] for [" + name + "]");
|
||||||
}
|
}
|
||||||
final T factory = type.get(settings, environemnt, name, currentSettings);
|
final T factory = type.get(settings, environment, name, currentSettings);
|
||||||
factories.put(name, factory);
|
factories.put(name, factory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,9 +355,9 @@ public final class AnalysisRegistry implements Closeable {
|
||||||
AnalysisModule.AnalysisProvider<T> defaultProvider = defaultInstance.get(name);
|
AnalysisModule.AnalysisProvider<T> defaultProvider = defaultInstance.get(name);
|
||||||
final T instance;
|
final T instance;
|
||||||
if (defaultProvider == null) {
|
if (defaultProvider == null) {
|
||||||
instance = provider.get(settings, environemnt, name, defaultSettings);
|
instance = provider.get(settings, environment, name, defaultSettings);
|
||||||
} else {
|
} else {
|
||||||
instance = defaultProvider.get(settings, environemnt, name, defaultSettings);
|
instance = defaultProvider.get(settings, environment, name, defaultSettings);
|
||||||
}
|
}
|
||||||
factories.put(name, instance);
|
factories.put(name, instance);
|
||||||
String camelCase = Strings.toCamelCase(name);
|
String camelCase = Strings.toCamelCase(name);
|
||||||
|
@ -371,7 +371,7 @@ public final class AnalysisRegistry implements Closeable {
|
||||||
final AnalysisModule.AnalysisProvider<T> provider = entry.getValue();
|
final AnalysisModule.AnalysisProvider<T> provider = entry.getValue();
|
||||||
final String camelCase = Strings.toCamelCase(name);
|
final String camelCase = Strings.toCamelCase(name);
|
||||||
if (factories.containsKey(name) == false || (defaultInstance.containsKey(camelCase) == false && factories.containsKey(camelCase) == false)) {
|
if (factories.containsKey(name) == false || (defaultInstance.containsKey(camelCase) == false && factories.containsKey(camelCase) == false)) {
|
||||||
final T instance = provider.get(settings, environemnt, name, defaultSettings);
|
final T instance = provider.get(settings, environment, name, defaultSettings);
|
||||||
if (factories.containsKey(name) == false) {
|
if (factories.containsKey(name) == false) {
|
||||||
factories.put(name, instance);
|
factories.put(name, instance);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue