...
|
...
|
@@ -248,29 +248,35 @@ public class SceneSelectionsService extends AbstractCacheAbleService { |
|
|
return this.aggregations(paramMap, commonAggregations, null);
|
|
|
}
|
|
|
|
|
|
public SearchApiResult aggregations(Map<String, String> paramMap, List<IAggregation> aggregations) throws Exception {
|
|
|
return this.aggregations(paramMap, aggregations, null);
|
|
|
public SearchApiResult aggregations(Map<String, String> paramMap, List<IAggregation> aggregations, boolean needRecommendBrand) throws Exception {
|
|
|
return this.aggregations(paramMap, aggregations, null,needRecommendBrand);
|
|
|
}
|
|
|
|
|
|
|
|
|
public SearchApiResult aggregations(Map<String, String> paramMap, BoolQueryBuilder mustFilter) throws Exception {
|
|
|
List<IAggregation> commonAggregations = this.getCommonAggregations(paramMap);
|
|
|
return this.aggregations(paramMap, commonAggregations, mustFilter);
|
|
|
}
|
|
|
|
|
|
public SearchApiResult aggregations(Map<String, String> paramMap, List<IAggregation> aggregations, BoolQueryBuilder mustFilter) throws Exception {
|
|
|
return this.aggregations(paramMap,aggregations,mustFilter,true);
|
|
|
}
|
|
|
|
|
|
public SearchApiResult aggregations(Map<String, String> paramMap, List<IAggregation> aggregations, BoolQueryBuilder mustFilter,boolean needRecommendBrand) throws Exception {
|
|
|
// 1、获取通用筛选项
|
|
|
CompletableFuture<JSONObject> commonFiltersFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
return this.getFiltersResult(paramMap, aggregations, mustFilter);
|
|
|
}, executorService);
|
|
|
// 2、获取推荐的品牌
|
|
|
CompletableFuture<Object> recommendBrandFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
return this.getRecommendBrands(paramMap, mustFilter);
|
|
|
}, executorService);
|
|
|
CompletableFuture<Object> recommendBrandFuture = null;
|
|
|
if(needRecommendBrand){
|
|
|
recommendBrandFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
return this.getRecommendBrands(paramMap, mustFilter);
|
|
|
}, executorService);
|
|
|
}
|
|
|
// 3、组合
|
|
|
JSONObject commonFilters = commonFiltersFuture.get();
|
|
|
Object recommendBrand = recommendBrandFuture.get();
|
|
|
if (recommendBrand != null) {
|
|
|
commonFilters.put("recommendBrand", recommendBrand);
|
|
|
if (needRecommendBrand && recommendBrandFuture != null) {
|
|
|
commonFilters.put("recommendBrand", recommendBrandFuture.get());
|
|
|
}
|
|
|
// 4、返回最终结果
|
|
|
Map<String, Object> result = new JSONObject();
|
...
|
...
|
|