SearchServiceConfiger.java 1.05 KB
package com.yoho.search.common;

import com.yoho.search.base.beans.SearchPropertyPlaceholderConfigurer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class SearchServiceConfiger {

    @Autowired
    private SearchPropertyPlaceholderConfigurer configurer;

    public String getSearchEsClusterName(){
        return configurer.getString("search.es.cluster.name","");
    }

    public String getSearchEsServers(){
        return configurer.getString("search.es.servers","");
    }

    public String getSearchMultiMatchQueryType(){
        return configurer.getString("search.multiMatchQuery.type", "BEST_FIELDS");
    }

    public String getSearchOperator(){
        return configurer.getString("search.operator", "or");
    }

    public String getSearchMinimumShouldMatch(){
        return configurer.getString("search.minimum.should.match", "75%");
    }

    public boolean useCache() {
        return configurer.getBoolean("search.use.cache", true);
    }
}