Authored by hugufei

去除config.properties中所有无用的配置

... ... @@ -2,6 +2,7 @@ package com.yoho.search.service.helper;
import com.yoho.search.base.utils.*;
import com.yoho.search.common.SearchServiceConfiger;
import com.yoho.search.core.es.utils.SearchFieldUtils;
import com.yoho.search.service.base.SearchDynamicConfigService;
import com.yoho.search.service.base.SearchRequestParams;
import org.apache.commons.collections.MapUtils;
... ... @@ -325,22 +326,7 @@ public class SearchCommonHelper {
// 获取MultiMatchQueryBuilder的类型
public MultiMatchQueryBuilder.Type getMultiMatchQueryBuilderType() {
String configMultiMatchQueryType = searchServiceConfiger.getSearchMultiMatchQueryType();
if (configMultiMatchQueryType.equalsIgnoreCase(MultiMatchQueryBuilder.Type.BEST_FIELDS.name())) {
return MultiMatchQueryBuilder.Type.BEST_FIELDS;
}
if (configMultiMatchQueryType.equalsIgnoreCase(MultiMatchQueryBuilder.Type.MOST_FIELDS.name())) {
return MultiMatchQueryBuilder.Type.MOST_FIELDS;
}
if (configMultiMatchQueryType.equalsIgnoreCase(MultiMatchQueryBuilder.Type.CROSS_FIELDS.name())) {
return MultiMatchQueryBuilder.Type.CROSS_FIELDS;
}
if (configMultiMatchQueryType.equalsIgnoreCase(MultiMatchQueryBuilder.Type.PHRASE.name())) {
return MultiMatchQueryBuilder.Type.PHRASE;
}
if (configMultiMatchQueryType.equalsIgnoreCase(MultiMatchQueryBuilder.Type.PHRASE_PREFIX.name())) {
return MultiMatchQueryBuilder.Type.PHRASE_PREFIX;
}
return null;
return SearchFieldUtils.getMultiMatchQueryBuilderType(configMultiMatchQueryType);
}
/**
... ...
package com.yoho.search.service.helper;
import com.yoho.search.base.beans.SearchPropertyPlaceholderConfigurer;
import com.yoho.search.base.constants.ProductModelValueConstants;
import com.yoho.search.base.utils.ConvertUtils;
import com.yoho.search.base.utils.DateUtil;
import com.yoho.search.base.utils.ISearchConstants;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.common.SearchServiceConfiger;
import com.yoho.search.common.utils.SearchKeyWordUtils;
import com.yoho.search.core.es.model.SearchField;
import com.yoho.search.core.es.utils.SearchFieldFactory;
import com.yoho.search.core.es.utils.SearchFieldUtils;
import com.yoho.search.service.base.SearchRequestParams;
import org.apache.commons.lang.StringUtils;
import org.apache.lucene.search.join.ScoreMode;
... ... @@ -96,7 +94,7 @@ public class SearchServiceHelper {
* @param queryBuilder
*/
private void setDefaultSearchField(MultiMatchQueryBuilder queryBuilder) {
List<SearchField> fuzzySearchFields = SearchFieldFactory.getFuzzySearchFields();
List<SearchField> fuzzySearchFields = SearchFieldUtils.getFuzzySearchFields();
for (SearchField searchField : fuzzySearchFields) {
queryBuilder.field(searchField.getEsField(),searchField.getBoost());
}
... ...
... ... @@ -10,7 +10,7 @@ import com.yoho.search.core.es.IElasticsearchClient;
import com.yoho.search.core.es.model.SearchField;
import com.yoho.search.core.es.model.SearchParam;
import com.yoho.search.core.es.model.SearchResult;
import com.yoho.search.core.es.utils.SearchFieldFactory;
import com.yoho.search.core.es.utils.SearchFieldUtils;
import com.yoho.search.service.base.ESClientMgr;
import com.yoho.search.service.searchexplainer.models.*;
import org.apache.commons.collections.CollectionUtils;
... ... @@ -688,7 +688,7 @@ public class SearchExplainerService {
return localMutilFields;
}
List<FieldWithBoost> list = new ArrayList<>();
List<SearchField> searchFields = SearchFieldFactory.getFuzzySearchFields();
List<SearchField> searchFields = SearchFieldUtils.getFuzzySearchFields();
for (SearchField searchField : searchFields) {
list.add(new FieldWithBoost(searchField.getEsField(), (int)searchField.getBoost()));
}
... ...
... ... @@ -8,7 +8,7 @@ import com.yoho.search.common.utils.SearchKeyWordUtils;
import com.yoho.search.core.es.model.SearchField;
import com.yoho.search.core.es.model.SearchParam;
import com.yoho.search.core.es.model.SearchResult;
import com.yoho.search.core.es.utils.SearchFieldFactory;
import com.yoho.search.core.es.utils.SearchFieldUtils;
import com.yoho.search.models.SearchApiResult;
import com.yoho.search.models.SearchSort;
import com.yoho.search.service.base.SearchCommonService;
... ... @@ -40,7 +40,6 @@ import org.elasticsearch.search.sort.SortOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import java.util.*;
@Service
... ... @@ -69,7 +68,7 @@ public class ShopListServiceImpl implements IShopListService {
// 2、构建query
MultiMatchQueryBuilder queryBuilder = QueryBuilders.multiMatchQuery(keyword);
queryBuilder.operator(Operator.OR);
List<SearchField> shopSearchFields = SearchFieldFactory.getShopNameSearchFields();
List<SearchField> shopSearchFields = SearchFieldUtils.getShopNameSearchFields();
for (SearchField searchField: shopSearchFields) {
queryBuilder.field(searchField.getEsField(), searchField.getBoost());
}
... ...
... ... @@ -19,11 +19,8 @@ search.index.refresh_interval = 1
search.index.translog.flush_threshold_ops = 5000
#search
search.minimum.should.match=75%
search.operator=and
search.default.field=productName_ansj^10,brandName^500,brandDomain^100,brandNameCn^100,brandNameEn^100,maxSort^300,middleSort^500,smallSort^1000,searchField_ansj,productSkn_ansj,brandNameCn_pinyin^100,maxSort_pinyin^300,middleSort_pinyin^500,smallSort_pinyin^1000,productKeyword^500,brandKeyword^50,searchField
search.script.score=_score+doc['sortWeight'].value*0.003+(100-doc['breakingRate'].value)/100 * doc['salesWithDateDiff'].value/pow((now-doc['shelveTime'].value)/3600+2,1.8)
search.script.lang=groovy
search.minimum.should.match=3<90%
search.operator=or
search.multiMatchQuery.type=CROSS_FIELDS
##tpl adaptor
... ...
#redis
redis.proxy.address=192.168.102.211
redis.proxy.port=6379
redis.proxy.auth=
redis.readonly.proxy.address=192.168.102.211
redis.readonly.proxy.port=6379
redis.readonly.proxy.auth=
#redis notsync
redis.notsync.twemproxy.addresses=192.168.102.211:6379
redis.notsync.twemproxy.auth=
#bigData - redis servers
bigDataRedis-search.proxy.address=123.206.17.17
bigDataRedis-search.proxy.port=16379
bigDataRedis-search.proxy.auth=
#search redis
redis.search.proxy.address =192.168.102.216
redis.search.proxy.port =6379
redis.search.proxy.auth =
#es.cluster
search.es.cluster.name=yohosearch_test
search.es.servers=192.168.102.209:9300 192.168.102.216:9300
search.index.number_of_replicas=0
search.index.refresh_interval=10s
search.index.translog.flush_threshold_ops=10000
#search
search.minimum.should.match=3<90%
search.operator=or
search.script.lang=groovy
search.use.cache=true
search.cache.type=redisCache
#personalized search
search.personalized.switch=true
search.personalized.max.should=50
tpl.adaptor.valid=true
search.multiMatchQuery.type=CROSS_FIELDS
search.open.downgrade=true
##cache
search.use.cache=true
#zkAddress
zkAddress=192.168.102.216:2181
... ...
#redis
redis.proxy.address=${redis.proxy.address}
redis.proxy.port=${redis.proxy.port}
redis.proxy.auth=${redis.proxy.auth}
redis.readonly.proxy.address=${redis.readonly.proxy.address}
redis.readonly.proxy.port=${redis.readonly.proxy.port}
redis.readonly.proxy.auth=${redis.readonly.proxy.auth}
#redis notsync
redis.notsync.twemproxy.addresses=${redis.notsync.twemproxy.addresses}
redis.notsync.twemproxy.auth=${redis.notsync.twemproxy.auth}
#bigData - redis servers
bigDataRedis-search.proxy.address=${bigDataRedis-search.proxy.address}
bigDataRedis-search.proxy.port=${bigDataRedis-search.proxy.port}
bigDataRedis-search.proxy.auth=${bigDataRedis-search.proxy.auth}
#search redis
redis.search.proxy.address=${redis.search.proxy.address}
redis.search.proxy.port=${redis.search.proxy.port}
redis.search.proxy.auth=${redis.search.proxy.auth}
#es.cluster
search.es.cluster.name=${search.es.cluster.name}
search.es.servers=${search.es.servers}
search.index.number_of_replicas=${search.index.number_of_replicas}
search.index.refresh_interval=${search.index.refresh_interval}
search.index.translog.flush_threshold_ops=${search.index.translog.flush_threshold_ops}
#search
search.minimum.should.match=3<90%
search.operator=or
search.script.lang=groovy
search.multiMatchQuery.type=CROSS_FIELDS
##cache
search.use.cache=true
search.cache.type=${search.cache.type}
#personalized search
search.personalized.switch=${search.personalized.switch}
search.personalized.max.should=${search.personalized.max.should}
tpl.adaptor.valid=${tpl.adaptor.valid}
search.multiMatchQuery.type=${search.multiMatchQuery.type}
search.open.downgrade=${search.open.downgrade}
#profile.threshold
profile.threshold=500
#zkAddress
zkAddress=${zkAddress}
#web.content
web.context=yohosearch
\ No newline at end of file
web.context=yohosearch
#profile.threshold
profile.threshold=500
\ No newline at end of file
... ...