|
|
package com.yoho.search.service.servicenew.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yoho.search.base.utils.ISearchConstants;
|
|
|
import com.yoho.search.core.es.agg.IAggregation;
|
...
|
...
|
@@ -176,7 +177,7 @@ public class SelectionWithOutAdvanceImpl implements ISelectionsWithOutAdvanceSer |
|
|
if (colorResponse != null) {
|
|
|
filter.put("color", colorResponse);
|
|
|
} else {
|
|
|
filter.put("color", colorIndexBaseService.getColorListByIds(Arrays.asList(paramMap.get("color").split(","))));
|
|
|
filter.put("color", new JSONArray());
|
|
|
}
|
|
|
|
|
|
// 5)获取风格层面的聚合结果
|
...
|
...
|
@@ -203,7 +204,7 @@ public class SelectionWithOutAdvanceImpl implements ISelectionsWithOutAdvanceSer |
|
|
if (sizeResponse != null) {
|
|
|
filter.put("size", sizeResponse);
|
|
|
} else {
|
|
|
filter.put("size", searchCommonService.doMultiGet(ISearchConstants.INDEX_NAME_SIZE, paramMap.get("size").split(","), null));
|
|
|
filter.put("size", new JSONArray());
|
|
|
}
|
|
|
|
|
|
// 8)获取规则的聚合结果[规格不会提前聚合]
|
...
|
...
|
@@ -221,20 +222,14 @@ public class SelectionWithOutAdvanceImpl implements ISelectionsWithOutAdvanceSer |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
// 9) 返回最新、限量、折扣
|
|
|
this.setNLS(aggMaps, filter);
|
|
|
// 9) 返回最新、限量、折扣、全球購
|
|
|
this.setOthers(aggMaps, filter);
|
|
|
|
|
|
// 10) 返回全球购的筛选项
|
|
|
IAggregation isGlobalAgg = aggregationFactoryService.getIsGlobalAggregation();
|
|
|
Object globalResponse = isGlobalAgg.getAggregationResponseMap(aggMaps);
|
|
|
if (globalResponse != null) {
|
|
|
filter.put("global", globalResponse);
|
|
|
}
|
|
|
return filter;
|
|
|
}
|
|
|
|
|
|
// 返回最新、限量、折扣的聚合结果
|
|
|
public void setNLS(Map<String, Aggregation> aggMaps, Map<String, Object> result) {
|
|
|
public void setOthers(Map<String, Aggregation> aggMaps, Map<String, Object> result) {
|
|
|
if (aggMaps.containsKey("isnewAgg")) {
|
|
|
if (getNLSMap((MultiBucketsAggregation) aggMaps.get("isnewAgg"))) {
|
|
|
result.put("new", "Y");
|
...
|
...
|
@@ -250,6 +245,11 @@ public class SelectionWithOutAdvanceImpl implements ISelectionsWithOutAdvanceSer |
|
|
result.put("specialoffer", "Y");
|
|
|
}
|
|
|
}
|
|
|
if (aggMaps.containsKey("isGlobalAgg")) {
|
|
|
if (getNLSMap((MultiBucketsAggregation) aggMaps.get("specialofferAgg"))) {
|
|
|
result.put("is_global", "Y");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private boolean getNLSMap(MultiBucketsAggregation aggregation) {
|
...
|
...
|
|