Authored by unknown

推荐品牌的BUG

package com.yoho.search.service.scene.common;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
... ... @@ -225,19 +226,21 @@ public class SceneSelectionsService extends BaseService {
private JSONObject getFiltersResult(Map<String, String> paramMap, List<IAggregation> aggregations, BoolQueryBuilder mustFilter) {
try {
SearchParam searchParam = searchParamHelper.buildWithMustFilter(paramMap, mustFilter);
Map<String, String> newParamMap = new HashMap<String, String>(paramMap);
SearchParam searchParam = searchParamHelper.buildWithMustFilter(newParamMap, mustFilter);
return this.getFiltersResults(paramMap, searchParam, aggregations);
} catch (Exception e) {
logger.error("[func=fuzzyAggregations][params=" + paramMap + "]", e);
logger.error("[func=SceneSelectionsService][params=" + paramMap + "]", e);
return new JSONObject();
}
}
private JSONArray getRecommendBrands(Map<String, String> paramMap, BoolQueryBuilder mustFilter) {
SearchApiResult searchApiResult = aggRecommendService.aggRecommendBrand(paramMap, mustFilter);
Map<String, String> newParamMap = new HashMap<String, String>(paramMap);
SearchApiResult searchApiResult = aggRecommendService.aggRecommendBrand(newParamMap, mustFilter);
return (JSONArray) searchApiResult.getData();
}
public SearchApiResult aggregations(Map<String, String> paramMap) throws Exception {
List<IAggregation> commonAggregations = this.getCommonAggregations(paramMap);
return this.aggregations(paramMap, commonAggregations, null);
... ...
... ... @@ -75,11 +75,12 @@ public class AggRecommendServiceImpl implements IAggRecommendService {
needPreAggregation = false;
}
int recommendBrandCount = Integer.parseInt(paramMap.getOrDefault(SearchRequestParams.PARAM_SEARCH_VIEWNUM, "8"));
paramMap.remove(SearchRequestParams.PARAM_SEARCH_ORDER);// 此接口
// paramMap.remove(SearchRequestParams.PARAM_SEARCH_ORDER);//
// 此接口不支持ORDER参数【只会按人气或者个性化打分排序】
// 2、构建带queryBuilder和filter的SearchParam
SearchParam searchParam = searchParamHelper.buildSearchParam(paramMap, true, mustFilter, needPreAggregation ? "brand" : null);
// 3、构造聚合
IAggregation recommendBrandAgg = aggregationFactoryService.getRecommendBrandAggregation(paramMap, recommendBrandCount);
searchParam.setAggregationBuilders(Arrays.asList(recommendBrandAgg.getBuilder()));
... ...