...
|
...
|
@@ -58,28 +58,26 @@ public class SelectionWithAdvanceImpl implements ISelectionsWithAdvanceService { |
|
|
@Override
|
|
|
public SearchApiResult getSelectionsForPc(Map<String, String> paramMap) {
|
|
|
try {
|
|
|
String productIndexName = ISearchConstants.INDEX_NAME_PRODUCT_INDEX;
|
|
|
BoolQueryBuilder boolFilter = searchServiceHelper.constructFilterBuilder(paramMap, null);
|
|
|
return this.getSelectionsWithAdvance(paramMap, productIndexName, boolFilter);
|
|
|
return this.getSelectionsWithAdvance(paramMap, boolFilter);
|
|
|
} catch (Exception e) {
|
|
|
logger.error(e.getMessage(), e);
|
|
|
return new SearchApiResult().setCode(500).setMessage("getSelectionsForBreakSize Exception:" + e.getMessage());
|
|
|
return new SearchApiResult().setCode(500).setMessage("getSelectionsForPc Exception:" + e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
@Override
|
|
|
public SearchApiResult getSelectionsForBreakSize(Map<String, String> paramMap) {
|
|
|
try {
|
|
|
String productIndexName = ISearchConstants.INDEX_NAME_STORAGE_SKU_INDEX;
|
|
|
BoolQueryBuilder boolFilter = breakSizeService.genBoolFilterBuilderForSortSize(paramMap);
|
|
|
return this.getSelectionsWithAdvance(paramMap, productIndexName, boolFilter);
|
|
|
return this.getSelectionsWithAdvance(paramMap, boolFilter);
|
|
|
} catch (Exception e) {
|
|
|
logger.error(e.getMessage(), e);
|
|
|
return new SearchApiResult().setCode(500).setMessage("getSelectionsForPc Exception:" + e.getMessage());
|
|
|
return new SearchApiResult().setCode(500).setMessage("getSelectionsForBreakSize Exception:" + e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public SearchApiResult getSelectionsWithAdvance(Map<String, String> paramMap, String indexName, BoolQueryBuilder boolQueryBuilder) throws Exception {
|
|
|
public SearchApiResult getSelectionsWithAdvance(Map<String, String> paramMap, BoolQueryBuilder boolQueryBuilder) throws Exception {
|
|
|
// 1)构造SearchParam
|
|
|
SearchParam searchParam = new SearchParam();
|
|
|
searchParam.setQuery(searchServiceHelper.constructQueryBuilder(paramMap));
|
...
|
...
|
@@ -92,6 +90,7 @@ public class SelectionWithAdvanceImpl implements ISelectionsWithAdvanceService { |
|
|
searchParam.setSize(0);
|
|
|
|
|
|
SearchParam searchParamClone = searchParam.clone();// 用来缓存
|
|
|
String indexName = ISearchConstants.INDEX_NAME_PRODUCT_INDEX;
|
|
|
|
|
|
// 2)从缓存里获取,取到则直接返回
|
|
|
JSONObject cacheObject = searchCacheService.getJSONObjectFromCache(indexName, searchParamClone);
|
...
|
...
|
|