Authored by hugufei

fix bug

package com.yoho.search.common.cache.aop;
public interface ISearchCacheAbleParam {
public String toCacheKeyValue();
}
... ...
... ... @@ -53,6 +53,7 @@ public class SearchCacheAspect {
SearchCache searchCache = searchCacheFactory.getAspectSearhCache(searchCacheAble);
boolean useJsonSerializable = searchCacheAble.cacheType().equals(CacheType.EHCACHE)?false:true;
Serializable cacheObject = searchCacheService.getSerializableObjectFromCache(searchCache, cacheKey, returnClass,useJsonSerializable);
if (cacheObject != null) {
return cacheObject;
}
... ... @@ -83,8 +84,8 @@ public class SearchCacheAspect {
private String getCacheKey(ProceedingJoinPoint pjp, SearchCacheAble searchCacheAble) {
Object[] arges = pjp.getArgs();
Object object = arges[0];
if (object instanceof SearchCacheAbleParam) {
return this.getCacheKey((SearchCacheAbleParam) object, searchCacheAble);
if (object instanceof ISearchCacheAbleParam) {
return this.getCacheKey((ISearchCacheAbleParam) object, searchCacheAble);
}
if (object instanceof HttpServletRequest) {
return this.getCacheKey((HttpServletRequest) object, searchCacheAble);
... ... @@ -96,7 +97,7 @@ public class SearchCacheAspect {
}
// 获取SearchCacheAbleParam的缓存key
private String getCacheKey(SearchCacheAbleParam searchCacheAbleParam, SearchCacheAble searchCacheAble) {
private String getCacheKey(ISearchCacheAbleParam searchCacheAbleParam, SearchCacheAble searchCacheAble) {
String valueString = searchCacheAbleParam.toCacheKeyValue();
return this.getRealCacheKey(valueString, searchCacheAble);
}
... ...
... ... @@ -13,10 +13,10 @@ import org.elasticsearch.search.sort.SortBuilders;
import org.elasticsearch.search.sort.SortOrder;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.common.cache.aop.SearchCacheAbleParam;
import com.yoho.search.common.cache.aop.ISearchCacheAbleParam;
import com.yoho.search.common.utils.HttpServletRequestUtils;
public class CommonRecallParam extends SearchCacheAbleParam {
public class CommonRecallParam implements ISearchCacheAbleParam {
private Map<String, String> paramMap;
private BoolQueryBuilder extendMustFilter;
... ...
... ... @@ -6,9 +6,9 @@ import java.util.List;
import org.apache.commons.lang.StringUtils;
import com.yoho.search.common.cache.aop.SearchCacheAbleParam;
import com.yoho.search.common.cache.aop.ISearchCacheAbleParam;
public class CommonRecallResult extends SearchCacheAbleParam implements Serializable {
public class CommonRecallResult implements ISearchCacheAbleParam,Serializable {
private static final long serialVersionUID = -5811560665992908361L;
private long totalCount = 0;
... ...
... ... @@ -155,7 +155,7 @@ public class ProductIndexBaseService {
productMap.put("max_sort_id", MapUtils.getIntValue(map, ProductIndexEsField.maxSortId));
productMap.put("middle_sort_id", MapUtils.getIntValue(map, ProductIndexEsField.middleSortId));
productMap.put("middle_sort_name", MapUtils.getIntValue(map, ProductIndexEsField.middleSort));
productMap.put("middle_sort_name", MapUtils.getString(map, ProductIndexEsField.middleSort,""));
productMap.put("small_sort_id", MapUtils.getIntValue(map, ProductIndexEsField.smallSortId));
productMap.put("small_sort_name", MapUtils.getString(map, ProductIndexEsField.smallSort, ""));
... ...