Java 类org.apache.lucene.analysis.ja.dict.TokenInfoFST 实例源码

项目:elasticsearch-analysis-ja    文件:ReloadableKuromojiTokenizerFactory.java   
@Override
public void reset() throws IOException {
    updateUserDictionary();

    if (dictionaryTimestamp > tokenizerTimestamp) {
        if (VERBOSE) {
            System.out.println("Update KuromojiTokenizer ("
                    + tokenizerTimestamp + "," + dictionaryTimestamp
                    + ")");
        }
        if (userDictionary != null) {
            try {
                tokenizerTimestamp = dictionaryTimestamp;
                userDictionaryField.set(tokenizer, userDictionary);
                final TokenInfoFST userFst = userDictionary.getFST();
                userFSTField.set(tokenizer, userFst);
                userFSTReaderField.set(tokenizer,
                        userFst.getBytesReader());
                @SuppressWarnings("unchecked")
                final
                EnumMap<Type, Dictionary> dictionaryMap = (EnumMap<Type, Dictionary>) dictionaryMapField.get(tokenizer);
                dictionaryMap.put(Type.USER, userDictionary);
            } catch (final Exception e) {
                throw new IllegalStateException(
                        "Failed to update the tokenizer.", e);
            }
        }
    }

    final Reader inputPending = getInputPending();
    if (inputPending != ILLEGAL_STATE_READER) {
        tokenizer.setReader(inputPending);
    }
    tokenizer.reset();
}