Skip to content

Commit

Permalink
[Analysis] Deprecate Standard Html Strip Analyzer
Browse files Browse the repository at this point in the history
Fixed some review comments

Related elastic#4704
  • Loading branch information
johtani committed Nov 1, 2018
1 parent caa4da0 commit d6bf840
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
3 changes: 3 additions & 0 deletions docs/reference/migration/migrate_6_1.asciidoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[[breaking-changes-6.1]]
== Breaking changes in 6.1
++++
<titleabbrev>6.1</titleabbrev>
++++

This section discusses the changes that you need to be aware of when migrating
your application to Elasticsearch 6.1.
Expand Down
6 changes: 4 additions & 2 deletions docs/reference/migration/migrate_6_5.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,7 @@ In 7.0.0 the `prefix` variant will be removed.
[float]
==== Deprecated standard_html_strip analyzer

Deprecated standard_html_strip analyser in 6.5.
This will be not create in 7.0 and be removed in 8.0.
The `standard_html_strip` analyzer has been deprecated, and should be replaced
with a combination of the `standard` tokenizer and `html_strip` char_filter.
Indexes created using this analyzer will still be readable in elasticsearch 7.0,
but it will not be possible to create new indexes using it.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class StandardHtmlStripAnalyzerProvider extends AbstractIndexAnalyzerProv
if (indexSettings.getIndexVersionCreated().onOrAfter(Version.V_6_5_0)) {
DEPRECATION_LOGGER.deprecatedAndMaybeLog("standard_html_strip_deprecation",
"Deprecated analyzer [standard_html_strip] used, " +
"replaced by using [html_strip] char_filter");
"replace it with a custom analyzer using [standard] tokenizer and [html_strip] char_filter, plus lowercase filter");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public void testEdgeNGramNoDeprecationWarningPre6_4() throws IOException {
/**
* Check that the deprecated analyzer name "standard_html_strip" issues a deprecation warning for indices created since 6.5.0
*/
public void testStandardHtmlStripAnalyzerDeprecationWrning() throws IOException {
public void testStandardHtmlStripAnalyzerDeprecationWarning() throws IOException {
Settings settings = Settings.builder().put(Environment.PATH_HOME_SETTING.getKey(), createTempDir())
.put(IndexMetaData.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_6_5_0, Version.CURRENT))
.put("index.analysis.analyzer.custom_analyzer.type", "standard_html_strip")
Expand All @@ -137,16 +137,17 @@ public void testStandardHtmlStripAnalyzerDeprecationWrning() throws IOException

assertNotNull(((NamedAnalyzer) analyzer).analyzer());
assertWarnings(
"Deprecated analyzer [standard_html_strip] used, replaced by using [html_strip] char_filter");
"Deprecated analyzer [standard_html_strip] used, " +
"replace it with a custom analyzer using [standard] tokenizer and [html_strip] char_filter, plus lowercase filter");
}
}

/**
* Check that the deprecated analyzer name "standard_html_strip" issues a deprecation warning for indices created before 6.4.0
* Check that the deprecated analyzer name "standard_html_strip" does NOT issue a deprecation warning for indices created before 6.4.0
*/
public void testStandardHtmlStripAnalyzerNoDeprecationPre6_5() throws IOException {
Settings settings = Settings.builder().put(Environment.PATH_HOME_SETTING.getKey(), createTempDir())
.put(IndexMetaData.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_5_0_0, Version.V_6_5_0))
.put(IndexMetaData.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_5_0_0, Version.V_6_4_0))
.put("index.analysis.analyzer.custom_analyzer.type", "standard_html_strip")
.putList("index.analysis.analyzer.custom_analyzer.stopwords", "a", "b")
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
features: "warnings"
- do:
warnings:
- 'Deprecated analyzer [standard_html_strip] used, replaced by using [html_strip] char_filter'
- 'Deprecated analyzer [standard_html_strip] used, replace it with a custom analyzer using [standard] tokenizer and [html_strip] char_filter, plus lowercase filter'
indices.analyze:
body:
text: <bold/> <italic/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public Analyzer getAnalyzer(String analyzer) throws IOException {
} else if ("standard_html_strip".equals(analyzer)) {
DEPRECATION_LOGGER.deprecatedAndMaybeLog("standard_html_strip_deprecation",
"Deprecated analyzer [standard_html_strip] used, " +
"replaced by using [html_strip] char_filter");
"replace it with a custom analyzer using [standard] tokenizer and [html_strip] char_filter, plus lowercase filter");
}
return analyzerProvider.get(environment, analyzer).get();
}
Expand Down

0 comments on commit d6bf840

Please sign in to comment.