Authored by 胡古飞

fix BrandWithShopsServiceImpl

@@ -31,16 +31,14 @@ import com.yoho.search.core.es.model.SearchParam; @@ -31,16 +31,14 @@ import com.yoho.search.core.es.model.SearchParam;
31 import com.yoho.search.core.es.model.SearchResult; 31 import com.yoho.search.core.es.model.SearchResult;
32 import com.yoho.search.core.es.utils.IgnoreSomeException; 32 import com.yoho.search.core.es.utils.IgnoreSomeException;
33 import com.yoho.search.service.cache.SearchCacheFactory; 33 import com.yoho.search.service.cache.SearchCacheFactory;
  34 +import com.yoho.search.service.cache.SearchCacheMatchLogger;
34 import com.yoho.search.service.cache.model.SearchCache; 35 import com.yoho.search.service.cache.model.SearchCache;
35 -import com.yoho.search.service.service.AggregationService;  
36 import com.yoho.search.service.service.SearchCacheService; 36 import com.yoho.search.service.service.SearchCacheService;
37 import com.yoho.search.service.service.SearchCommonService; 37 import com.yoho.search.service.service.SearchCommonService;
38 import com.yoho.search.service.service.base.BrandIndexBaseService; 38 import com.yoho.search.service.service.base.BrandIndexBaseService;
39 import com.yoho.search.service.service.base.ShopsIndexBaseService; 39 import com.yoho.search.service.service.base.ShopsIndexBaseService;
40 import com.yoho.search.service.service.helper.SearchParamHelper; 40 import com.yoho.search.service.service.helper.SearchParamHelper;
41 -import com.yoho.search.service.service.helper.SearchSortHelper;  
42 import com.yoho.search.service.servicenew.IBrandWithShopsService; 41 import com.yoho.search.service.servicenew.IBrandWithShopsService;
43 -import com.yoho.search.service.utils.HttpServletRequestUtils;  
44 import com.yoho.search.service.utils.SearchApiResultUtils; 42 import com.yoho.search.service.utils.SearchApiResultUtils;
45 import com.yoho.search.service.vo.SearchApiResult; 43 import com.yoho.search.service.vo.SearchApiResult;
46 import com.yoho.search.service.vo.brand.BrandShopInfo; 44 import com.yoho.search.service.vo.brand.BrandShopInfo;
@@ -53,12 +51,8 @@ public class BrandWithShopsServiceImpl implements IBrandWithShopsService, Applic @@ -53,12 +51,8 @@ public class BrandWithShopsServiceImpl implements IBrandWithShopsService, Applic
53 private static Logger CACHE_MATCH_REQUEST = LoggerFactory.getLogger("CACHE_MATCH_REQUEST"); 51 private static Logger CACHE_MATCH_REQUEST = LoggerFactory.getLogger("CACHE_MATCH_REQUEST");
54 52
55 @Autowired 53 @Autowired
56 - private SearchSortHelper searchSortHelper;  
57 - @Autowired  
58 private SearchParamHelper searchParamHelper; 54 private SearchParamHelper searchParamHelper;
59 @Autowired 55 @Autowired
60 - private AggregationService aggregationService;  
61 - @Autowired  
62 private SearchCommonService searchCommonService; 56 private SearchCommonService searchCommonService;
63 @Autowired 57 @Autowired
64 private ShopsIndexBaseService shopsIndexBaseService; 58 private ShopsIndexBaseService shopsIndexBaseService;
@@ -107,7 +101,7 @@ public class BrandWithShopsServiceImpl implements IBrandWithShopsService, Applic @@ -107,7 +101,7 @@ public class BrandWithShopsServiceImpl implements IBrandWithShopsService, Applic
107 final String indexName = ISearchConstants.INDEX_NAME_PRODUCT_INDEX; 101 final String indexName = ISearchConstants.INDEX_NAME_PRODUCT_INDEX;
108 JSONObject cacheObject = searchCacheService.getJSONObjectFromCache(brandAndShopSearchCache,indexName, searchParam); 102 JSONObject cacheObject = searchCacheService.getJSONObjectFromCache(brandAndShopSearchCache,indexName, searchParam);
109 if (cacheObject != null) { 103 if (cacheObject != null) {
110 - CACHE_MATCH_REQUEST.info("match cache , url is :/brands.json?" + HttpServletRequestUtils.genParamString(paramMap)); 104 + SearchCacheMatchLogger.doSearchCacheMatchLog("brandsWithShops", paramMap);
111 return new SearchApiResult().setData(cacheObject); 105 return new SearchApiResult().setData(cacheObject);
112 } 106 }
113 // 4、查询ES 107 // 4、查询ES
@@ -139,7 +133,7 @@ public class BrandWithShopsServiceImpl implements IBrandWithShopsService, Applic @@ -139,7 +133,7 @@ public class BrandWithShopsServiceImpl implements IBrandWithShopsService, Applic
139 /** 133 /**
140 * 制作品牌报文 134 * 制作品牌报文
141 */ 135 */
142 - private Map<String, JSONArray> makeBrandResponse(MultiBucketsAggregation aggregation) throws Exception { 136 + private Map<String, JSONArray> makeBrandResponse(MultiBucketsAggregation aggregation){
143 // 1)获取每个brandAlif-->brandId->List<BrandShopInfo> 137 // 1)获取每个brandAlif-->brandId->List<BrandShopInfo>
144 Map<String, Map<String, List<BrandShopInfo>>> brandAlif2BrandShopInfos = new LinkedHashMap<String, Map<String, List<BrandShopInfo>>>(); 138 Map<String, Map<String, List<BrandShopInfo>>> brandAlif2BrandShopInfos = new LinkedHashMap<String, Map<String, List<BrandShopInfo>>>();
145 for (Bucket brandAlifBucket : aggregation.getBuckets()) { 139 for (Bucket brandAlifBucket : aggregation.getBuckets()) {