Authored by 胡古飞

fix AggRecommendServiceImpl

package com.yoho.search.service.cache;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.yoho.search.base.utils.HttpServletRequestUtils;
public class CatchMatchLogger {
private static final Logger CACHE_MATCH_REQUEST = LoggerFactory.getLogger("CACHE_MATCH_REQUEST");
public static void doCatchMatchLog(String url, Map<String, String> paramMap) {
CACHE_MATCH_REQUEST.info("match cache , url is :{}?{}", url, HttpServletRequestUtils.genParamString(paramMap));
}
}
... ...
... ... @@ -17,11 +17,11 @@ import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yoho.search.base.utils.CollectionUtils;
import com.yoho.search.base.utils.HttpServletRequestUtils;
import com.yoho.search.base.utils.ISearchConstants;
import com.yoho.search.core.es.agg.IAggregation;
import com.yoho.search.core.es.model.SearchParam;
import com.yoho.search.service.aggregations.impls.AggregationFactoryService;
import com.yoho.search.service.cache.CatchMatchLogger;
import com.yoho.search.service.cache.SearchCacheFactory;
import com.yoho.search.service.cache.model.SearchCache;
import com.yoho.search.service.service.AggregationService;
... ... @@ -36,7 +36,6 @@ import com.yoho.search.service.vo.SearchApiResult;
public class AggRecommendServiceImpl implements IAggRecommendService {
private static final Logger logger = LoggerFactory.getLogger(AggRecommendServiceImpl.class);
private static final Logger CACHE_MATCH_REQUEST = LoggerFactory.getLogger("CACHE_MATCH_REQUEST");
@Autowired
private AggregationService aggregationService;
... ... @@ -92,7 +91,7 @@ public class AggRecommendServiceImpl implements IAggRecommendService {
final String productIndexName = ISearchConstants.INDEX_NAME_PRODUCT_INDEX;
JSONArray cacheJSONArray = searchCacheService.getJSONArrayFromCache(searchCache, productIndexName, searchParam);
if (cacheJSONArray != null) {
CACHE_MATCH_REQUEST.info("match cache , url is :/productindex/aggRecommendBrand.json?{}", HttpServletRequestUtils.genParamString(paramMap));
CatchMatchLogger.doCatchMatchLog("/productindex/aggRecommendBrand.json", paramMap);
return new SearchApiResult().setData(cacheJSONArray);
}
// 6、从ES中获取
... ... @@ -134,7 +133,7 @@ public class AggRecommendServiceImpl implements IAggRecommendService {
final String productIndexName = ISearchConstants.INDEX_NAME_PRODUCT_INDEX;
JSONArray cacheJSONArray = searchCacheService.getJSONArrayFromCache(searchCache, productIndexName, searchParam);
if (cacheJSONArray != null) {
CACHE_MATCH_REQUEST.info("match cache , url is :/productindex/aggRecommendShop.json?{}",HttpServletRequestUtils.genParamString(paramMap));
CatchMatchLogger.doCatchMatchLog("/productindex/aggRecommendShop.json", paramMap);
return this.getRecommendShopSearchApiResult(cacheJSONArray, page, count);
}
// 6、从ES中获取
... ...