Created
January 17, 2018 17:22
-
-
Save mayya-sharipova/27cdcdc427327235d126c11280ee01ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -42,6 +42,8 @@ import java.util.concurrent.ConcurrentHashMap; | |
import java.util.stream.Collectors; | |
import static java.util.Collections.unmodifiableMap; | |
+import org.elasticsearch.common.logging.DeprecationLogger; | |
+import org.elasticsearch.common.logging.Loggers; | |
/** | |
* An internal registry for tokenizer, token filter, char filter and analyzer. | |
@@ -61,6 +63,9 @@ public final class AnalysisRegistry implements Closeable { | |
private final Map<String, AnalysisProvider<AnalyzerProvider<?>>> analyzers; | |
private final Map<String, AnalysisProvider<AnalyzerProvider<?>>> normalizers; | |
+ private static final DeprecationLogger DEPRECATION_LOGGER = new DeprecationLogger(Loggers.getLogger(AnalysisRegistry.class)); | |
+ | |
+ | |
public AnalysisRegistry(Environment environment, | |
Map<String, AnalysisProvider<CharFilterFactory>> charFilters, | |
Map<String, AnalysisProvider<TokenFilterFactory>> tokenFilters, | |
@@ -111,6 +116,11 @@ public final class AnalysisRegistry implements Closeable { | |
* Returns a registered {@link CharFilterFactory} provider by name or <code>null</code> if the char filter was not registered | |
*/ | |
public AnalysisModule.AnalysisProvider<CharFilterFactory> getCharFilterProvider(String charFilter) { | |
+ if (charFilter.equals("htmlStrip")){ | |
+ DEPRECATION_LOGGER.deprecated("The [htmpStrip] char filter name is deprecated and will be removed in a future version. " | |
+ + "Please change the filter name to [html_strip] instead."); | |
+ charFilter = "html_strip"; | |
+ } | |
return charFilters.getOrDefault(charFilter, this.prebuiltAnalysis.getCharFilterFactory(charFilter)); | |
} | |
@@ -332,6 +342,11 @@ public final class AnalysisRegistry implements Closeable { | |
continue; | |
} | |
} | |
+ if (component.name().equals("CHAR_FILTER") && typeName.equals("htmlStrip")){ | |
+ DEPRECATION_LOGGER.deprecated("The [htmpStrip] char filter name is deprecated and will be removed in a future version. " | |
+ + "Please change the filter name to [html_strip] instead."); | |
+ typeName = "html_strip"; | |
+ } | |
AnalysisProvider<T> type = getAnalysisProvider(component, providerMap, name, typeName); | |
if (type == null) { | |
throw new IllegalArgumentException("Unknown " + component + " type [" + typeName + "] for [" + name + "]"); | |
60,1 Bot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment