Search in sources :

Example 1 with EdgeNGramTokenFilterFactory

use of org.elasticsearch.index.analysis.EdgeNGramTokenFilterFactory in project elasticsearch by elastic.

the class FragmentBuilderHelper method containsBrokenAnalysis.

private static boolean containsBrokenAnalysis(Analyzer analyzer) {
    // TODO maybe we need a getter on Namedanalyzer that tells if this uses broken Analysis
    if (analyzer instanceof NamedAnalyzer) {
        analyzer = ((NamedAnalyzer) analyzer).analyzer();
    }
    if (analyzer instanceof CustomAnalyzer) {
        final CustomAnalyzer a = (CustomAnalyzer) analyzer;
        TokenFilterFactory[] tokenFilters = a.tokenFilters();
        for (TokenFilterFactory tokenFilterFactory : tokenFilters) {
            if (tokenFilterFactory instanceof WordDelimiterTokenFilterFactory || tokenFilterFactory instanceof EdgeNGramTokenFilterFactory) {
                return true;
            }
        }
    }
    return false;
}
Also used : WordDelimiterTokenFilterFactory(org.elasticsearch.index.analysis.WordDelimiterTokenFilterFactory) EdgeNGramTokenFilterFactory(org.elasticsearch.index.analysis.EdgeNGramTokenFilterFactory) NamedAnalyzer(org.elasticsearch.index.analysis.NamedAnalyzer) CustomAnalyzer(org.elasticsearch.index.analysis.CustomAnalyzer) NGramTokenFilterFactory(org.elasticsearch.index.analysis.NGramTokenFilterFactory) WordDelimiterTokenFilterFactory(org.elasticsearch.index.analysis.WordDelimiterTokenFilterFactory) EdgeNGramTokenFilterFactory(org.elasticsearch.index.analysis.EdgeNGramTokenFilterFactory) TokenFilterFactory(org.elasticsearch.index.analysis.TokenFilterFactory)

Aggregations

CustomAnalyzer (org.elasticsearch.index.analysis.CustomAnalyzer)1 EdgeNGramTokenFilterFactory (org.elasticsearch.index.analysis.EdgeNGramTokenFilterFactory)1 NGramTokenFilterFactory (org.elasticsearch.index.analysis.NGramTokenFilterFactory)1 NamedAnalyzer (org.elasticsearch.index.analysis.NamedAnalyzer)1 TokenFilterFactory (org.elasticsearch.index.analysis.TokenFilterFactory)1 WordDelimiterTokenFilterFactory (org.elasticsearch.index.analysis.WordDelimiterTokenFilterFactory)1