All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.elasticsearch.plugin.analysis.pinyin.AnalysisPinyinPlugin Maven / Gradle / Ivy

The newest version!
package org.elasticsearch.plugin.analysis.pinyin;


import org.apache.lucene.analysis.Analyzer;
import org.elasticsearch.index.analysis.*;
import org.elasticsearch.indices.analysis.AnalysisModule;
import org.elasticsearch.plugins.AnalysisPlugin;
import org.elasticsearch.plugins.Plugin;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;


public class AnalysisPinyinPlugin extends Plugin implements AnalysisPlugin {

    @Override
    public Map> getTokenizers() {
        Map> extra = new HashMap<>();
        extra.put("pinyin", PinyinTokenizerFactory::new);
        extra.put("pinyin_first_letter", PinyinAbbreviationsTokenizerFactory::new);
        return extra;
    }

    @Override
    public Map> getTokenFilters() {
        Map> extra = new HashMap<>();
        extra.put("pinyin", PinyinTokenFilterFactory::new);
        return extra;
    }

    @Override
    public Map>> getAnalyzers() {
        return Collections.singletonMap("pinyin", PinyinAnalyzerProvider::new);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy