Skip to content

Commit 66b694c

Browse files
author
Christoph Büscher
committed
iter
1 parent 0c2dfe4 commit 66b694c

File tree

4 files changed

+13
-16
lines changed

4 files changed

+13
-16
lines changed

modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/CommonAnalysisPlugin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ public Map<String, AnalysisProvider<TokenizerFactory>> getTokenizers() {
176176
public List<PreConfiguredCharFilter> getPreConfiguredCharFilters() {
177177
List<PreConfiguredCharFilter> filters = new ArrayList<>();
178178
filters.add(PreConfiguredCharFilter.singleton("html_strip", false, HTMLStripCharFilter::new));
179-
filters.add(PreConfiguredCharFilter.singleton("htmlStrip", false, (reader, version) -> {
180-
if (version.onOrAfter(org.elasticsearch.Version.V_7_0_0_alpha1)) {
179+
filters.add(PreConfiguredCharFilter.singletonWithVersion("htmlStrip", false, (reader, version) -> {
180+
if (version.onOrAfter(org.elasticsearch.Version.V_6_3_0)) {
181181
DEPRECATION_LOGGER.deprecatedAndMaybeLog("htmlStrip_deprecation",
182182
"The [htmpStrip] char filter name is deprecated and will be removed in a future version. "
183183
+ "Please change the filter name to [html_strip] instead.");

modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/HtmlStripCharFilterFactoryTests.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,30 +37,30 @@
3737
public class HtmlStripCharFilterFactoryTests extends ESTestCase {
3838

3939
/**
40-
* Check that the deprecated name "htmlStrip" issues a deprecation warning for indices created since 6.0.0
40+
* Check that the deprecated name "htmlStrip" issues a deprecation warning for indices created since 6.3.0
4141
*/
4242
public void testDeprecationWarning() throws IOException {
4343
Settings settings = Settings.builder().put(Environment.PATH_HOME_SETTING.getKey(), createTempDir())
44-
.put(IndexMetaData.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, Version.CURRENT))
44+
.put(IndexMetaData.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_6_3_0, Version.CURRENT))
4545
.build();
4646

4747
IndexSettings idxSettings = IndexSettingsModule.newIndexSettings("index", settings);
4848
try (CommonAnalysisPlugin commonAnalysisPlugin = new CommonAnalysisPlugin()) {
4949
Map<String, CharFilterFactory> charFilters = createTestAnalysis(idxSettings, settings, commonAnalysisPlugin).charFilter;
5050
CharFilterFactory charFilterFactory = charFilters.get("htmlStrip");
5151
assertNotNull(charFilterFactory.create(new StringReader("input")));
52-
assertWarnings(
53-
"The [htmpStrip] char filter name is deprecated and will be removed in a future version. "
52+
assertWarnings("The [htmpStrip] char filter name is deprecated and will be removed in a future version. "
5453
+ "Please change the filter name to [html_strip] instead.");
5554
}
5655
}
5756

5857
/**
59-
* Check that the deprecated name "htmlStrip" does NOT issues a deprecation warning for indices created before 6.0.0
58+
* Check that the deprecated name "htmlStrip" does NOT issues a deprecation warning for indices created before 6.3.0
6059
*/
61-
public void testNoDeprecationWarningPre6() throws IOException {
60+
public void testNoDeprecationWarningPre6_3() throws IOException {
6261
Settings settings = Settings.builder().put(Environment.PATH_HOME_SETTING.getKey(), createTempDir())
63-
.put(IndexMetaData.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_5_0_0, Version.V_5_6_4))
62+
.put(IndexMetaData.SETTING_VERSION_CREATED,
63+
VersionUtils.randomVersionBetween(random(), Version.V_5_0_0, Version.V_6_2_4))
6464
.build();
6565

6666
IndexSettings idxSettings = IndexSettingsModule.newIndexSettings("index", settings);

modules/analysis-common/src/test/resources/rest-api-spec/test/indices.analyze/10_analyze.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
---
2121
"htmlStrip_deprecated":
2222
- skip:
23-
version: " - 6.0.99"
24-
reason: deprecated in 6.1
23+
version: " - 6.2.99"
24+
reason: deprecated in 6.3
2525
features: "warnings"
2626

2727
- do:
@@ -57,7 +57,7 @@
5757
index:
5858
index: test_deprecated_htmlstrip
5959
type: type
60-
id: 1
60+
id: 2
6161
body: { "name": "foo baz" }
6262

6363
- do:
@@ -70,4 +70,3 @@
7070
text: "<html>foo</html>"
7171
- length: { tokens: 1 }
7272
- match: { tokens.0.token: "\nfoo\n" }
73-

server/src/main/java/org/elasticsearch/index/analysis/PreConfiguredCharFilter.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public static PreConfiguredCharFilter singleton(String name, boolean useFilterFo
4343
/**
4444
* Create a pre-configured char filter that may not vary at all, provide access to the elasticsearch verison
4545
*/
46-
public static PreConfiguredCharFilter singleton(String name, boolean useFilterForMultitermQueries,
46+
public static PreConfiguredCharFilter singletonWithVersion(String name, boolean useFilterForMultitermQueries,
4747
BiFunction<Reader, org.elasticsearch.Version, Reader> create) {
4848
return new PreConfiguredCharFilter(name, CachingStrategy.ONE, useFilterForMultitermQueries,
4949
(reader, version) -> create.apply(reader, version));
@@ -66,8 +66,6 @@ public static PreConfiguredCharFilter elasticsearchVersion(String name, boolean
6666
return new PreConfiguredCharFilter(name, CachingStrategy.ELASTICSEARCH, useFilterForMultitermQueries, create);
6767
}
6868

69-
70-
7169
private final boolean useFilterForMultitermQueries;
7270
private final BiFunction<Reader, Version, Reader> create;
7371

0 commit comments

Comments
 (0)