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

org.elasticsearch.module.suggest.SuggestModule Maven / Gradle / Ivy

package org.elasticsearch.module.suggest;

import org.elasticsearch.action.GenericAction;
import org.elasticsearch.action.suggest.SuggestAction;
import org.elasticsearch.action.suggest.SuggestRefreshAction;
import org.elasticsearch.action.suggest.TransportSuggestAction;
import org.elasticsearch.action.suggest.TransportSuggestRefreshAction;
import org.elasticsearch.action.support.TransportAction;
import org.elasticsearch.common.inject.AbstractModule;
import org.elasticsearch.common.inject.multibindings.MapBinder;
public class SuggestModule extends AbstractModule {

    @Override
    protected void configure() {
        bind(TransportSuggestAction.class).asEagerSingleton();
        bind(TransportSuggestRefreshAction.class).asEagerSingleton();

        MapBinder transportActionsBinder =
            MapBinder.newMapBinder(binder(), GenericAction.class, TransportAction.class);

        transportActionsBinder.addBinding(SuggestAction.INSTANCE).to(TransportSuggestAction.class).asEagerSingleton();
        transportActionsBinder.addBinding(SuggestRefreshAction.INSTANCE).to(TransportSuggestRefreshAction.class).asEagerSingleton();

        MapBinder actionsBinder = MapBinder.newMapBinder(binder(), String.class, GenericAction.class);
        actionsBinder.addBinding(SuggestAction.NAME).toInstance(SuggestAction.INSTANCE);
        actionsBinder.addBinding(SuggestRefreshAction.NAME).toInstance(SuggestRefreshAction.INSTANCE);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy