Authored by wangnan

helper回退

... ... @@ -84,11 +84,12 @@ public class HelperServiceImpl extends BaseService implements IHelperService, Ap
MultiMatchQueryBuilder queryBuilder = QueryBuilders.multiMatchQuery(keyword);
queryBuilder.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS);
queryBuilder.operator(MatchQueryBuilder.Operator.OR);
if (paramMap.containsKey(SearchRequestParams.HELPER_PARAM_ISCUSTOMERSERVICE) && StringUtils.isNotBlank(paramMap.get(SearchRequestParams.HELPER_PARAM_ISCUSTOMERSERVICE))) {
queryBuilder.minimumShouldMatch("50%");
}else{
queryBuilder.minimumShouldMatch("30%");
}
// if (paramMap.containsKey(SearchRequestParams.HELPER_PARAM_ISCUSTOMERSERVICE) && StringUtils.isNotBlank(paramMap.get(SearchRequestParams.HELPER_PARAM_ISCUSTOMERSERVICE))) {
// queryBuilder.minimumShouldMatch("50%");
// }else{
// queryBuilder.minimumShouldMatch("30%");
// }
queryBuilder.minimumShouldMatch("50%");
queryBuilder.field("caption", 200).field("keywords", 100);
// 4.配置Filter
... ... @@ -141,7 +142,8 @@ public class HelperServiceImpl extends BaseService implements IHelperService, Ap
*/
private BoolQueryBuilder constructHelperFilterBuilder(Map<String, String> paramMap) throws Exception {
BoolQueryBuilder boolFilter = QueryBuilders.boolQuery();
boolFilter = boolQueryTermQuery(paramMap, boolFilter, SearchRequestParams.HELPER_PARAM_ISCUSTOMERSERVICE);
//boolFilter = boolQueryTermQuery(paramMap, boolFilter, SearchRequestParams.HELPER_PARAM_ISCUSTOMERSERVICE);
boolFilter.must(QueryBuilders.termQuery(SearchRequestParams.HELPER_PARAM_ISCUSTOMERSERVICE, "N"));
boolFilter.must(QueryBuilders.termQuery(SearchRequestParams.HELPER_PARAM_STATUS, 1));
boolFilter = boolQueryTermQuery(paramMap, boolFilter, SearchRequestParams.HELPER_PARAM_FIRSTCATEGORYID);
boolFilter = boolQueryTermQuery(paramMap, boolFilter, SearchRequestParams.HELPER_PARAM_SECENDCATEGORYID);
... ...