From 2cde3b07cdb75ff82952489ee983572eb0d5f0a5 Mon Sep 17 00:00:00 2001 From: Jun Ohtani Date: Fri, 12 Aug 2016 21:54:45 +0900 Subject: [PATCH] Stop using cached component in _analyze API Add javadoc some methods Closes #19827 --- .../index/analysis/AnalysisRegistry.java | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/elasticsearch/index/analysis/AnalysisRegistry.java b/core/src/main/java/org/elasticsearch/index/analysis/AnalysisRegistry.java index 9730462325e..119e0c16ea0 100644 --- a/core/src/main/java/org/elasticsearch/index/analysis/AnalysisRegistry.java +++ b/core/src/main/java/org/elasticsearch/index/analysis/AnalysisRegistry.java @@ -73,6 +73,12 @@ public final class AnalysisRegistry implements Closeable { this.analyzers = unmodifiableMap(analyzers); } + /** + * Returns a {@link Settings} by groupName from {@link IndexSettings} or a default {@link Settings} + * @param indexSettings an index settings + * @param groupName tokenizer/token filter/char filter name + * @return {@link Settings} + */ public static Settings getSettingsFromIndexSettings(IndexSettings indexSettings, String groupName) { Settings settings = indexSettings.getSettings().getAsSettings(groupName); if (settings.isEmpty()) { @@ -154,7 +160,14 @@ public final class AnalysisRegistry implements Closeable { return new AnalysisService(indexSettings, analyzierFactories, tokenizerFactories, charFilterFactories, tokenFilterFactories); } - + /** + * Returns a registered {@link TokenizerFactory} provider by {@link IndexSettings} + * or a registered {@link TokenizerFactory} provider by predefined name + * or null if the tokenizer was not registered + * @param tokenizer global or defined tokenizer name + * @param indexSettings an index settings + * @return {@link TokenizerFactory} provider or null + */ public AnalysisProvider getTokenizerProvider(String tokenizer, IndexSettings indexSettings) { final Map tokenizerSettings = indexSettings.getSettings().getGroups("index.analysis.tokenizer"); if (tokenizerSettings.containsKey(tokenizer)) { @@ -165,6 +178,14 @@ public final class AnalysisRegistry implements Closeable { } } + /** + * Returns a registered {@link TokenFilterFactory} provider by {@link IndexSettings} + * or a registered {@link TokenFilterFactory} provider by predefined name + * or null if the tokenFilter was not registered + * @param tokenFilter global or defined tokenFilter name + * @param indexSettings an index settings + * @return {@link TokenFilterFactory} provider or null + */ public AnalysisProvider getTokenFilterProvider(String tokenFilter, IndexSettings indexSettings) { final Map tokenFilterSettings = indexSettings.getSettings().getGroups("index.analysis.filter"); if (tokenFilterSettings.containsKey(tokenFilter)) { @@ -185,6 +206,14 @@ public final class AnalysisRegistry implements Closeable { } } + /** + * Returns a registered {@link CharFilterFactory} provider by {@link IndexSettings} + * or a registered {@link CharFilterFactory} provider by predefined name + * or null if the charFilter was not registered + * @param charFilter global or defined charFilter name + * @param indexSettings an index settings + * @return {@link CharFilterFactory} provider or null + */ public AnalysisProvider getCharFilterProvider(String charFilter, IndexSettings indexSettings) { final Map tokenFilterSettings = indexSettings.getSettings().getGroups("index.analysis.char_filter"); if (tokenFilterSettings.containsKey(charFilter)) {