Authored by wangnan

helper fix

@@ -84,12 +84,11 @@ public class HelperServiceImpl extends BaseService implements IHelperService, Ap @@ -84,12 +84,11 @@ public class HelperServiceImpl extends BaseService implements IHelperService, Ap
84 MultiMatchQueryBuilder queryBuilder = QueryBuilders.multiMatchQuery(keyword); 84 MultiMatchQueryBuilder queryBuilder = QueryBuilders.multiMatchQuery(keyword);
85 queryBuilder.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS); 85 queryBuilder.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS);
86 queryBuilder.operator(MatchQueryBuilder.Operator.OR); 86 queryBuilder.operator(MatchQueryBuilder.Operator.OR);
87 -// if (paramMap.containsKey(SearchRequestParams.HELPER_PARAM_ISCUSTOMERSERVICE) && StringUtils.isNotBlank(paramMap.get(SearchRequestParams.HELPER_PARAM_ISCUSTOMERSERVICE))) {  
88 -// queryBuilder.minimumShouldMatch("50%");  
89 -// }else{  
90 -// queryBuilder.minimumShouldMatch("30%");  
91 -// }  
92 - queryBuilder.minimumShouldMatch("50%"); 87 + if (paramMap.containsKey("showCustomerService") && StringUtils.isNotBlank(paramMap.get("showCustomerService")) && paramMap.get("showCustomerService").equals("Y")) {
  88 + queryBuilder.minimumShouldMatch("30%");
  89 + } else {
  90 + queryBuilder.minimumShouldMatch("50%");
  91 + }
93 queryBuilder.field("caption", 200).field("keywords", 100); 92 queryBuilder.field("caption", 200).field("keywords", 100);
94 93
95 // 4.配置Filter 94 // 4.配置Filter
@@ -142,7 +141,10 @@ public class HelperServiceImpl extends BaseService implements IHelperService, Ap @@ -142,7 +141,10 @@ public class HelperServiceImpl extends BaseService implements IHelperService, Ap
142 */ 141 */
143 private BoolQueryBuilder constructHelperFilterBuilder(Map<String, String> paramMap) throws Exception { 142 private BoolQueryBuilder constructHelperFilterBuilder(Map<String, String> paramMap) throws Exception {
144 BoolQueryBuilder boolFilter = QueryBuilders.boolQuery(); 143 BoolQueryBuilder boolFilter = QueryBuilders.boolQuery();
145 - //boolFilter = boolQueryTermQuery(paramMap, boolFilter, SearchRequestParams.HELPER_PARAM_ISCUSTOMERSERVICE); 144 + if (!paramMap.containsKey("showCustomerService") || !StringUtils.isNotBlank(paramMap.get("showCustomerService")) || !paramMap.get("showCustomerService").equals("Y")) {
  145 + boolFilter.must(QueryBuilders.termQuery(SearchRequestParams.HELPER_PARAM_ISCUSTOMERSERVICE, "N"));
  146 + }
  147 + boolFilter = boolQueryTermQuery(paramMap, boolFilter, SearchRequestParams.HELPER_PARAM_ISCUSTOMERSERVICE);
146 boolFilter.must(QueryBuilders.termQuery(SearchRequestParams.HELPER_PARAM_ISCUSTOMERSERVICE, "N")); 148 boolFilter.must(QueryBuilders.termQuery(SearchRequestParams.HELPER_PARAM_ISCUSTOMERSERVICE, "N"));
147 boolFilter.must(QueryBuilders.termQuery(SearchRequestParams.HELPER_PARAM_STATUS, 1)); 149 boolFilter.must(QueryBuilders.termQuery(SearchRequestParams.HELPER_PARAM_STATUS, 1));
148 boolFilter = boolQueryTermQuery(paramMap, boolFilter, SearchRequestParams.HELPER_PARAM_FIRSTCATEGORYID); 150 boolFilter = boolQueryTermQuery(paramMap, boolFilter, SearchRequestParams.HELPER_PARAM_FIRSTCATEGORYID);