...
|
...
|
@@ -19,6 +19,7 @@ import org.springframework.stereotype.Service; |
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yoho.search.common.cache.model.SearchCache;
|
|
|
import com.yoho.search.common.utils.SnappyUtils;
|
|
|
import com.yoho.search.core.es.model.SearchParam;
|
|
|
import com.yoho.search.models.SearchApiResult;
|
|
|
import com.yoho.search.service.base.SearchDynamicConfigService;
|
...
|
...
|
@@ -69,7 +70,7 @@ public class SearchLikeNotInShopService extends AbstractCacheAbleService { |
|
|
String redisCacheKey = searchCacheKeyHelper.getSearchLikeNotInShopKeyCache(productSkn, pageSize);
|
|
|
JSONObject cacheObject = searchCacheService.getJSONObjectFromCache(this.searchCache, redisCacheKey);
|
|
|
if (cacheObject != null) {
|
|
|
return new SearchApiResult().setData(cacheObject);
|
|
|
return new SearchApiResult().setData(SnappyUtils.compress(cacheObject));
|
|
|
}
|
|
|
|
|
|
// 4、获取当前查询的SKN的基本信息
|
...
|
...
|
@@ -104,8 +105,8 @@ public class SearchLikeNotInShopService extends AbstractCacheAbleService { |
|
|
result.put("product_list", productListResults);
|
|
|
|
|
|
// 8、结果加入缓存
|
|
|
String compressedReturnValue=searchCacheService.addJSONObjectToCacheAndReturn(this.searchCache, redisCacheKey, result);
|
|
|
return new SearchApiResult().setData(compressedReturnValue).setCompress(true);
|
|
|
searchCacheService.addJSONObjectToCache(this.searchCache, redisCacheKey, result);
|
|
|
return new SearchApiResult().setData(SnappyUtils.compress(result)).setCompress(true);
|
|
|
} catch (Exception e) {
|
|
|
logger.error(e.getMessage(), e);
|
|
|
return new SearchApiResult().setData(null).setMessage("searchLikeNotInShop Exception").setCode(500);
|
...
|
...
|
|