|
@@ -138,8 +138,8 @@ public class SearchServiceHelper { |
|
@@ -138,8 +138,8 @@ public class SearchServiceHelper { |
138
|
}
|
138
|
}
|
139
|
|
139
|
|
140
|
private boolean isNeedDeScoreBrandSearch(Map<String, String> paramMap) {
|
140
|
private boolean isNeedDeScoreBrandSearch(Map<String, String> paramMap) {
|
141
|
- //如果品牌降分总开关未开启,则直接返回
|
|
|
142
|
- if(!dynamicConfig.deScoreBrandOpen()){
|
141
|
+ // 如果品牌降分总开关未开启,则直接返回
|
|
|
142
|
+ if (!dynamicConfig.deScoreBrandOpen()) {
|
143
|
return false;
|
143
|
return false;
|
144
|
}
|
144
|
}
|
145
|
// 如果是按售价或者折扣排序或品牌也或店铺页,则降分不生效
|
145
|
// 如果是按售价或者折扣排序或品牌也或店铺页,则降分不生效
|
|
@@ -294,17 +294,17 @@ public class SearchServiceHelper { |
|
@@ -294,17 +294,17 @@ public class SearchServiceHelper { |
294
|
if (StringUtils.isBlank(keyword)) {
|
294
|
if (StringUtils.isBlank(keyword)) {
|
295
|
return QueryBuilders.matchAllQuery();
|
295
|
return QueryBuilders.matchAllQuery();
|
296
|
}
|
296
|
}
|
297
|
- //0、处理is_encode的情况,编码转换
|
|
|
298
|
- String is_encode = paramMap.get("is_encode");
|
|
|
299
|
- if(StringUtils.isNotBlank(is_encode)&&is_encode.equals("1")){
|
|
|
300
|
- try {
|
|
|
301
|
- keyword = URLDecoder.decode(keyword, "UTF-8");
|
|
|
302
|
- } catch (UnsupportedEncodingException e) {
|
|
|
303
|
- logger.warn(e.getMessage(),e);
|
|
|
304
|
- }
|
|
|
305
|
- }
|
|
|
306
|
- paramMap.put("query", keyword);
|
|
|
307
|
-
|
297
|
+ // 0、处理is_encode的情况,编码转换
|
|
|
298
|
+ String is_encode = paramMap.get("is_encode");
|
|
|
299
|
+ if (StringUtils.isNotBlank(is_encode) && is_encode.equals("1")) {
|
|
|
300
|
+ try {
|
|
|
301
|
+ keyword = URLDecoder.decode(keyword, "UTF-8");
|
|
|
302
|
+ } catch (UnsupportedEncodingException e) {
|
|
|
303
|
+ logger.warn(e.getMessage(), e);
|
|
|
304
|
+ }
|
|
|
305
|
+ }
|
|
|
306
|
+ paramMap.put("query", keyword);
|
|
|
307
|
+
|
308
|
// 1、处理查询中包含性别的情况
|
308
|
// 1、处理查询中包含性别的情况
|
309
|
this.dealKeywordOfGender(keyword, paramMap);
|
309
|
this.dealKeywordOfGender(keyword, paramMap);
|
310
|
|
310
|
|
|
@@ -372,15 +372,12 @@ public class SearchServiceHelper { |
|
@@ -372,15 +372,12 @@ public class SearchServiceHelper { |
372
|
queryBuilder = this.buildPersonalSearch(queryBuilder, paramMap);
|
372
|
queryBuilder = this.buildPersonalSearch(queryBuilder, paramMap);
|
373
|
|
373
|
|
374
|
String dynamicRuleValue = dynamicSearchRuleHelper.getDynamicRuleValue(paramMap);
|
374
|
String dynamicRuleValue = dynamicSearchRuleHelper.getDynamicRuleValue(paramMap);
|
375
|
- if(StringUtils.isEmpty(dynamicRuleValue) || "-1".equals(dynamicRuleValue))
|
|
|
376
|
- {
|
375
|
+ if (StringUtils.isEmpty(dynamicRuleValue) || "-1".equals(dynamicRuleValue)) {
|
377
|
queryBuilder = this.buildDeScoreBrandSearch(queryBuilder, paramMap);
|
376
|
queryBuilder = this.buildDeScoreBrandSearch(queryBuilder, paramMap);
|
378
|
queryBuilder = this.buildGlobalSearch(queryBuilder, paramMap);
|
377
|
queryBuilder = this.buildGlobalSearch(queryBuilder, paramMap);
|
379
|
- }
|
|
|
380
|
- else {
|
378
|
+ } else {
|
381
|
queryBuilder = dynamicSearchRuleHelper.buildDynamicSerach(queryBuilder, paramMap, dynamicRuleValue);
|
379
|
queryBuilder = dynamicSearchRuleHelper.buildDynamicSerach(queryBuilder, paramMap, dynamicRuleValue);
|
382
|
}
|
380
|
}
|
383
|
-
|
|
|
384
|
return queryBuilder;
|
381
|
return queryBuilder;
|
385
|
}
|
382
|
}
|
386
|
|
383
|
|
|
@@ -513,7 +510,7 @@ public class SearchServiceHelper { |
|
@@ -513,7 +510,7 @@ public class SearchServiceHelper { |
513
|
*/
|
510
|
*/
|
514
|
public void setDefaultSearchField(MultiMatchQueryBuilder queryBuilder, Map<String, String> paramMap) {
|
511
|
public void setDefaultSearchField(MultiMatchQueryBuilder queryBuilder, Map<String, String> paramMap) {
|
515
|
List<String> fields = dynamicSearchRuleHelper.getDynamicSearchFields(paramMap);
|
512
|
List<String> fields = dynamicSearchRuleHelper.getDynamicSearchFields(paramMap);
|
516
|
- if(CollectionUtils.isEmpty(fields)){
|
513
|
+ if (CollectionUtils.isEmpty(fields)) {
|
517
|
fields = ISearchConstants.SEARCH_DEFAULT_FIELD;
|
514
|
fields = ISearchConstants.SEARCH_DEFAULT_FIELD;
|
518
|
}
|
515
|
}
|
519
|
|
516
|
|
|
@@ -604,7 +601,7 @@ public class SearchServiceHelper { |
|
@@ -604,7 +601,7 @@ public class SearchServiceHelper { |
604
|
if ("Y".equals(paramMap.get(SearchRequestParams.PARAM_SEARCH_GLOBAL_FILTER_BRAND))) {
|
601
|
if ("Y".equals(paramMap.get(SearchRequestParams.PARAM_SEARCH_GLOBAL_FILTER_BRAND))) {
|
605
|
boolFilter.mustNot(QueryBuilders.termQuery("isForbiddenSortBrand", 1));
|
602
|
boolFilter.mustNot(QueryBuilders.termQuery("isForbiddenSortBrand", 1));
|
606
|
}
|
603
|
}
|
607
|
-
|
604
|
+
|
608
|
// 店铺
|
605
|
// 店铺
|
609
|
if (paramMap.containsKey(SearchRequestParams.PARAM_SEARCH_SHOP) && StringUtils.isNotBlank(paramMap.get(SearchRequestParams.PARAM_SEARCH_SHOP))
|
606
|
if (paramMap.containsKey(SearchRequestParams.PARAM_SEARCH_SHOP) && StringUtils.isNotBlank(paramMap.get(SearchRequestParams.PARAM_SEARCH_SHOP))
|
610
|
&& !SearchRequestParams.PARAM_SEARCH_SHOP.equals(filterParamName)) {
|
607
|
&& !SearchRequestParams.PARAM_SEARCH_SHOP.equals(filterParamName)) {
|