Example usage for org.apache.lucene.analysis.ja.dict UserDictionary open

List of usage examples for org.apache.lucene.analysis.ja.dict UserDictionary open

Introduction

In this page you can find the example usage for org.apache.lucene.analysis.ja.dict UserDictionary open.

Prototype

public static UserDictionary open(Reader reader) throws IOException 

Source Link

Usage

From source file:org.elasticsearch.index.analysis.Kuromoji2TokenizerFactory.java

License:Apache License

public static UserDictionary getUserDictionary(Environment env, Settings settings) {
    try {//ww  w .  j  ava2  s  . co  m
        final Reader reader = Analysis.getReaderFromFile(env, settings, USER_DICT_OPTION);
        if (reader == null) {
            return null;
        } else {
            try {
                return UserDictionary.open(reader);
            } finally {
                reader.close();
            }
        }
    } catch (IOException e) {
        throw new ElasticsearchException("failed to load kuromoji user dictionary", e);
    }
}