...
|
...
|
@@ -55,8 +55,6 @@ public class ShopsServiceImpl extends BaseService implements IShopsService, Appl |
|
|
@Autowired
|
|
|
private AggregationService aggregationService;
|
|
|
@Autowired
|
|
|
private SearchCommonHelper searchCommonHelper;
|
|
|
@Autowired
|
|
|
private AggregationFactoryService aggregationFactoryService;
|
|
|
@Autowired
|
|
|
private SearchParamHelper searchParamHelper;
|
...
|
...
|
@@ -76,14 +74,12 @@ public class ShopsServiceImpl extends BaseService implements IShopsService, Appl |
|
|
int topHitCount = StringUtils.isBlank(paramMap.get("viewNum")) ? 10 : Integer.parseInt(paramMap.get("viewNum"));
|
|
|
// 2、获取聚合的排序规则
|
|
|
String topHitOrder = "heatValue:desc";
|
|
|
|
|
|
// 3、构建searchParam
|
|
|
SearchParam searchParam = searchParamHelper.buildWithPersional(paramMap, topHitCount > 0 ? true : false);
|
|
|
SearchParam searchParam = searchParamHelper.buildWithPersional(paramMap, false);
|
|
|
IAggregation groupShopAgg = aggregationFactoryService.getGroupShopAggregation(topHitOrder, topHitCount);
|
|
|
searchParam.setAggregationBuilders(Arrays.asList(groupShopAgg.getBuilder()));
|
|
|
searchParam.setOffset(0);
|
|
|
searchParam.setSize(0);
|
|
|
|
|
|
// 4、从ES中获取
|
|
|
JSONObject aggNameAndResponse = aggregationService.getAggNameAndResponseWithTotal(groupShopAgg, searchParam);
|
|
|
if (aggNameAndResponse == null) {
|
...
|
...
|
|