...
|
...
|
@@ -31,16 +31,14 @@ import com.yoho.search.core.es.model.SearchParam; |
|
|
import com.yoho.search.core.es.model.SearchResult;
|
|
|
import com.yoho.search.core.es.utils.IgnoreSomeException;
|
|
|
import com.yoho.search.service.cache.SearchCacheFactory;
|
|
|
import com.yoho.search.service.cache.SearchCacheMatchLogger;
|
|
|
import com.yoho.search.service.cache.model.SearchCache;
|
|
|
import com.yoho.search.service.service.AggregationService;
|
|
|
import com.yoho.search.service.service.SearchCacheService;
|
|
|
import com.yoho.search.service.service.SearchCommonService;
|
|
|
import com.yoho.search.service.service.base.BrandIndexBaseService;
|
|
|
import com.yoho.search.service.service.base.ShopsIndexBaseService;
|
|
|
import com.yoho.search.service.service.helper.SearchParamHelper;
|
|
|
import com.yoho.search.service.service.helper.SearchSortHelper;
|
|
|
import com.yoho.search.service.servicenew.IBrandWithShopsService;
|
|
|
import com.yoho.search.service.utils.HttpServletRequestUtils;
|
|
|
import com.yoho.search.service.utils.SearchApiResultUtils;
|
|
|
import com.yoho.search.service.vo.SearchApiResult;
|
|
|
import com.yoho.search.service.vo.brand.BrandShopInfo;
|
...
|
...
|
@@ -53,12 +51,8 @@ public class BrandWithShopsServiceImpl implements IBrandWithShopsService, Applic |
|
|
private static Logger CACHE_MATCH_REQUEST = LoggerFactory.getLogger("CACHE_MATCH_REQUEST");
|
|
|
|
|
|
@Autowired
|
|
|
private SearchSortHelper searchSortHelper;
|
|
|
@Autowired
|
|
|
private SearchParamHelper searchParamHelper;
|
|
|
@Autowired
|
|
|
private AggregationService aggregationService;
|
|
|
@Autowired
|
|
|
private SearchCommonService searchCommonService;
|
|
|
@Autowired
|
|
|
private ShopsIndexBaseService shopsIndexBaseService;
|
...
|
...
|
@@ -107,7 +101,7 @@ public class BrandWithShopsServiceImpl implements IBrandWithShopsService, Applic |
|
|
final String indexName = ISearchConstants.INDEX_NAME_PRODUCT_INDEX;
|
|
|
JSONObject cacheObject = searchCacheService.getJSONObjectFromCache(brandAndShopSearchCache,indexName, searchParam);
|
|
|
if (cacheObject != null) {
|
|
|
CACHE_MATCH_REQUEST.info("match cache , url is :/brands.json?" + HttpServletRequestUtils.genParamString(paramMap));
|
|
|
SearchCacheMatchLogger.doSearchCacheMatchLog("brandsWithShops", paramMap);
|
|
|
return new SearchApiResult().setData(cacheObject);
|
|
|
}
|
|
|
// 4、查询ES
|
...
|
...
|
@@ -139,7 +133,7 @@ public class BrandWithShopsServiceImpl implements IBrandWithShopsService, Applic |
|
|
/**
|
|
|
* 制作品牌报文
|
|
|
*/
|
|
|
private Map<String, JSONArray> makeBrandResponse(MultiBucketsAggregation aggregation) throws Exception {
|
|
|
private Map<String, JSONArray> makeBrandResponse(MultiBucketsAggregation aggregation){
|
|
|
// 1)获取每个brandAlif-->brandId->List<BrandShopInfo>
|
|
|
Map<String, Map<String, List<BrandShopInfo>>> brandAlif2BrandShopInfos = new LinkedHashMap<String, Map<String, List<BrandShopInfo>>>();
|
|
|
for (Bucket brandAlifBucket : aggregation.getBuckets()) {
|
...
|
...
|
|