Authored by 胡古飞

抽取isProductList至controller

... ... @@ -29,6 +29,7 @@ public class ProductListController {
@ResponseBody
public SearchApiResult productList(HttpServletRequest request) {
Map<String, String> paramMap = HttpServletRequestUtils.transParamType(request);
paramMap.put("isProductList", "Y");// 加个参数,表明是商品列表
return productListService.productList(paramMap);
}
... ... @@ -41,6 +42,7 @@ public class ProductListController {
@ResponseBody
public SearchApiResult getESDsl(HttpServletRequest request) {
Map<String, String> paramMap = HttpServletRequestUtils.transParamType(request);
paramMap.put("isProductList", "Y");// 加个参数,表明是商品列表
return productListService.getESDsl(paramMap);
}
... ...
... ... @@ -138,8 +138,8 @@ public class SearchServiceHelper {
}
private boolean isNeedDeScoreBrandSearch(Map<String, String> paramMap) {
//如果品牌降分总开关未开启,则直接返回
if(!dynamicConfig.deScoreBrandOpen()){
// 如果品牌降分总开关未开启,则直接返回
if (!dynamicConfig.deScoreBrandOpen()) {
return false;
}
// 如果是按售价或者折扣排序或品牌也或店铺页,则降分不生效
... ... @@ -294,13 +294,13 @@ public class SearchServiceHelper {
if (StringUtils.isBlank(keyword)) {
return QueryBuilders.matchAllQuery();
}
//0、处理is_encode的情况,编码转换
// 0、处理is_encode的情况,编码转换
String is_encode = paramMap.get("is_encode");
if(StringUtils.isNotBlank(is_encode)&&is_encode.equals("1")){
if (StringUtils.isNotBlank(is_encode) && is_encode.equals("1")) {
try {
keyword = URLDecoder.decode(keyword, "UTF-8");
} catch (UnsupportedEncodingException e) {
logger.warn(e.getMessage(),e);
logger.warn(e.getMessage(), e);
}
}
paramMap.put("query", keyword);
... ... @@ -372,15 +372,12 @@ public class SearchServiceHelper {
queryBuilder = this.buildPersonalSearch(queryBuilder, paramMap);
String dynamicRuleValue = dynamicSearchRuleHelper.getDynamicRuleValue(paramMap);
if(StringUtils.isEmpty(dynamicRuleValue) || "-1".equals(dynamicRuleValue))
{
if (StringUtils.isEmpty(dynamicRuleValue) || "-1".equals(dynamicRuleValue)) {
queryBuilder = this.buildDeScoreBrandSearch(queryBuilder, paramMap);
queryBuilder = this.buildGlobalSearch(queryBuilder, paramMap);
}
else {
} else {
queryBuilder = dynamicSearchRuleHelper.buildDynamicSerach(queryBuilder, paramMap, dynamicRuleValue);
}
return queryBuilder;
}
... ... @@ -513,7 +510,7 @@ public class SearchServiceHelper {
*/
public void setDefaultSearchField(MultiMatchQueryBuilder queryBuilder, Map<String, String> paramMap) {
List<String> fields = dynamicSearchRuleHelper.getDynamicSearchFields(paramMap);
if(CollectionUtils.isEmpty(fields)){
if (CollectionUtils.isEmpty(fields)) {
fields = ISearchConstants.SEARCH_DEFAULT_FIELD;
}
... ...
... ... @@ -146,7 +146,6 @@ public class ProductListServiceImpl implements IProductListService {
}
// 2)构建基本查询参数
paramMap.put("isProductList", "Y");// 加个参数,表明是商品列表
SearchParam searchParam = new SearchParam();
searchParam.setQuery(searchServiceHelper.constructQueryBuilderForProductList(paramMap));
searchParam.setFiter(searchServiceHelper.constructFilterBuilder(paramMap, null));
... ...