ConsumerConfiger.java 2.48 KB
package com.yoho.search.consumer.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 ConsumerConfiger {

    @Autowired
    private SearchPropertyPlaceholderConfigurer configurer;

    /******************************for full build**************************************/
    public int getSearchIndexBatchLimit(){
        return configurer.getInt("search.index.batch.limit", 5000);
    }

    public int getSearchIndexBatchMaxThreadSize(){
        return configurer.getInt("search.index.batch.max.thread.size", 5);
    }

    /******************************for tbl**************************************/
    public String getTblProductUrl(){
        return configurer.getString("tbl.product.url", "http://test.soa.global.yohobuy.com/product/api/v1/detail/");
    }

    public String getTblPrimaryKey(){
        return configurer.getString("tbl.product.private.key", "a85bb0674e08986c6b115d5e3a4884fa");
    }

    public String getTblAdaptorDomain(){
        return configurer.getString("tpl.adaptor.domain", "http://192.168.102.224:8085/search-adaptor");
    }

    /******************************for Suggestion**************************************/
    public int getSuggestionCountBatchLimit (){
        return configurer.getInt("suggestion.count.batch.limit", 300);
    }
    public int getSuggestionCountBatchMaxThreadSize(){
        return configurer.getInt("suggestion.count.batch.max.thread.size", 1);
    }

    public int getSuggestionDiscoverBatchLimit(){
        return configurer.getInt("suggestion.discover.batch.limit", 500);
    }

    public int getSuggestionDiscoverBatchMaxThreadSize(){
        return configurer.getInt("suggestion.discover.batch.max.thread.size", 3);
    }


    /******************************for search**************************************/
    public List<String> getSearchDefaultField(){
        return configurer.getList("search.default.field");
    }

    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%");
    }

}