Ver Fonte

Remove rests of StandardHtmlStripAnalyzer (#43485)

StandardHtmlStripAnalyzer has been deprecated in 6.x and cannot be used for new
indices from 7.0 on. This change removes it entirely and also removes the from
tests and deprecation logging that has still been around during the 7.x
versions.
Christoph Büscher há 6 anos atrás
pai
commit
62d13e9468

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

@@ -322,9 +322,6 @@ public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, Scri
     @Override
     public List<PreBuiltAnalyzerProviderFactory> getPreBuiltAnalyzerProviderFactories() {
         List<PreBuiltAnalyzerProviderFactory> analyzers = new ArrayList<>();
-        // TODO remove in 8.0
-        analyzers.add(new PreBuiltAnalyzerProviderFactory("standard_html_strip", CachingStrategy.ELASTICSEARCH,
-            () -> new StandardHtmlStripAnalyzer(CharArraySet.EMPTY_SET)));
         analyzers.add(new PreBuiltAnalyzerProviderFactory("pattern", CachingStrategy.ELASTICSEARCH,
             () -> new PatternAnalyzer(Regex.compile("\\W+" /*PatternAnalyzer.NON_WORD_PATTERN*/, null), true,
             CharArraySet.EMPTY_SET)));

+ 0 - 58
modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/StandardHtmlStripAnalyzer.java

@@ -1,58 +0,0 @@
-/*
- * Licensed to Elasticsearch under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.elasticsearch.analysis.common;
-
-import org.apache.lucene.analysis.CharArraySet;
-import org.apache.lucene.analysis.LowerCaseFilter;
-import org.apache.lucene.analysis.StopFilter;
-import org.apache.lucene.analysis.StopwordAnalyzerBase;
-import org.apache.lucene.analysis.TokenStream;
-import org.apache.lucene.analysis.Tokenizer;
-import org.apache.lucene.analysis.en.EnglishAnalyzer;
-import org.apache.lucene.analysis.standard.StandardTokenizer;
-
-public class StandardHtmlStripAnalyzer extends StopwordAnalyzerBase {
-
-    /**
-     * @deprecated use {@link StandardHtmlStripAnalyzer#StandardHtmlStripAnalyzer(CharArraySet)} instead
-     */
-    @Deprecated
-    public StandardHtmlStripAnalyzer() {
-        super(EnglishAnalyzer.ENGLISH_STOP_WORDS_SET);
-    }
-    /**
-     * @deprecated in 6.5, can not create in 7.0, and we remove this in 8.0
-     */
-    @Deprecated
-    StandardHtmlStripAnalyzer(CharArraySet stopwords) {
-        super(stopwords);
-    }
-
-    @Override
-    protected TokenStreamComponents createComponents(final String fieldName) {
-        final Tokenizer src = new StandardTokenizer();
-        TokenStream tok = new LowerCaseFilter(src);
-        if (!stopwords.isEmpty()) {
-            tok = new StopFilter(tok, stopwords);
-        }
-        return new TokenStreamComponents(src, tok);
-    }
-
-}

+ 0 - 9
modules/analysis-common/src/test/resources/rest-api-spec/test/analysis-common/20_analyzers.yml

@@ -67,15 +67,6 @@
     - length: { tokens: 1 }
     - match:  { tokens.0.token: a1 b2 c3 d4 }
 
----
-"standard_html_strip":
-    - do:
-        catch: /\[standard_html_strip\] analyzer is not supported for new indices, use a custom analyzer using \[standard\] tokenizer and \[html_strip\] char_filter, plus \[lowercase\] filter/
-        indices.analyze:
-          body:
-            text:     <bold/> <italic/>
-            analyzer: standard_html_strip
-
 ---
 "pattern":
     - do:

+ 0 - 4
server/src/main/java/org/elasticsearch/index/analysis/AnalysisRegistry.java

@@ -185,11 +185,7 @@ public final class AnalysisRegistry implements Closeable {
                             throw new ElasticsearchException("failed to load analyzer for name " + key, ex);
                         }}
             );
-        } else if ("standard_html_strip".equals(analyzer)) {
-            throw new IllegalArgumentException("[standard_html_strip] analyzer is not supported for new indices, " +
-                "use a custom analyzer using [standard] tokenizer and [html_strip] char_filter, plus [lowercase] filter");
         }
-
         return analyzerProvider.get(environment, analyzer).get();
     }