package org.elasticsearch.index.analysis;

import org.apache.lucene.analysis.Analyzer;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.inject.assistedinject.Assisted;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment;
import org.elasticsearch.index.Index;
import org.elasticsearch.index.settings.IndexSettings;
import org.wltea.analyzer.dic.Dictionary;
import org.wltea.analyzer.lucene.IKAnalyzer;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;

public class IkAnalyzerProvider extends AbstractIndexAnalyzerProvider<IKAnalyzer> {
    private final IKAnalyzer analyzer;
    private ESLogger logger=null;
    @Inject
    public IkAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
        super(index, indexSettings, name, settings);

//        logger = Loggers.getLogger("ik-analyzer");
//
//        logger.info("[Setting] {}",settings.getAsMap().toString());
//        logger.info("[Index Setting] {}",indexSettings.getAsMap().toString());
//        logger.info("[Env Setting] {}",env.configFile());

        analyzer=new IKAnalyzer(indexSettings);
    }

    @Override
    public String name() {
        return "ik";
    }

    @Override
    public AnalyzerScope scope() {
        return AnalyzerScope.INDEX;
    }


    @Override public IKAnalyzer get() {
        return this.analyzer;
    }
}

@@ -1285,32 +1285,34 @@
 ngs);%0D%0A    %7D%0D%0A%0D%0A
+/*
     @Override%0D%0A 
@@ -1458,24 +1458,473 @@
 NDEX;%0D%0A    %7D
+*/%0D%0A%0D%0A%0D%0A    public IkAnalyzerProvider(Index index, Settings indexSettings, String name,%0D%0A    %09%09Settings settings) %7B%0D%0A%09%09super(index, indexSettings, name, settings);%0D%0A%09%09analyzer=new IKAnalyzer(indexSettings);%0D%0A%09%7D%0D%0A%0D%0A%09public IkAnalyzerProvider(Index index, Settings indexSettings,%0D%0A%09%09%09String prefixSettings, String name, Settings settings) %7B%0D%0A%09%09super(index, indexSettings, prefixSettings, name, settings);%0D%0A%09%09analyzer=new IKAnalyzer(indexSettings);%0D%0A%09%7D
 %0D%0A%0D%0A%0D%0A    @O

fix bug when upgrading to elasticsearch-0.19.4