/*
* Copyright (C) 2014 Jörg Prante
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program; if not, see http://www.gnu.org/licenses
* or write to the Free Software Foundation, Inc., 51 Franklin Street,
* Fifth Floor, Boston, MA 02110-1301 USA.
*
* The interactive user interfaces in modified source and object code
* versions of this program must display Appropriate Legal Notices,
* as required under Section 5 of the GNU Affero General Public License.
*
*/
package org.xbib.elasticsearch.plugin.analysis.german;
import org.elasticsearch.common.component.LifecycleComponent;
import org.elasticsearch.common.inject.Module;
import org.elasticsearch.index.analysis.AnalysisModule;
import org.elasticsearch.plugins.AbstractPlugin;
import org.xbib.elasticsearch.index.analysis.combo.ComboAnalysisBinderProcessor;
import org.xbib.elasticsearch.index.analysis.german.GermanAnalysisBinderProcessor;
import org.xbib.elasticsearch.index.analysis.icu.IcuAnalysisBinderProcessor;
import org.xbib.elasticsearch.index.analysis.langdetect.LangdetectModule;
import org.xbib.elasticsearch.index.analysis.langdetect.LangdetectService;
import java.util.Collection;
import static org.elasticsearch.common.collect.Lists.newArrayList;
public class AnalysisGermanPlugin extends AbstractPlugin {
@Override
public String name() {
return "analysis-german-" +
Build.getInstance().getVersion() + "-" +
Build.getInstance().getShortHash();
}
@Override
public String description() {
return "German language related analysis support";
}
/**
* Automatically called with the analysis module.
*/
public void onModule(AnalysisModule module) {
module.addProcessor(new ComboAnalysisBinderProcessor());
module.addProcessor(new IcuAnalysisBinderProcessor());
module.addProcessor(new GermanAnalysisBinderProcessor());
}
@Override
public Collection<Class<? extends LifecycleComponent>> services() {
Collection<Class<? extends LifecycleComponent>> services = newArrayList();
services.add(LangdetectService.class);
return services;
}
@Override
public Collection<Class<? extends Module>> indexModules() {
Collection<Class<? extends Module>> modules = newArrayList();
modules.add(LangdetectModule.class);
return modules;
}
}