Authored by WN\wangnan

【图片搜索】fix

... ... @@ -9,7 +9,6 @@ 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.SearchCacheService;
import com.yoho.search.service.service.SearchCommonService;
... ... @@ -128,17 +127,17 @@ public class SknImageVectorsServiceImpl implements ISknImageVectorsService, Appl
// 3.走本地缓存
SearchResult searchResult = new SearchResult();
final String indexName = ISearchConstants.INDEX_NAME_IMAGE_VECTORS;
JSONObject cacheObject = searchCacheService.getJSONObjectFromCache(searchCache, indexName, searchParam);
if (cacheObject != null) {
SearchCacheMatchLogger.doSearchCacheMatchLog("/searchSknByPhoto.json", paramMap);
searchResult = (SearchResult)cacheObject.get("SearchResult");
} else {
// JSONObject cacheObject = searchCacheService.getJSONObjectFromCache(searchCache, indexName, searchParam);
// if (cacheObject != null) {
// SearchCacheMatchLogger.doSearchCacheMatchLog("/searchSknByPhoto.json", paramMap);
// searchResult = (SearchResult)cacheObject.get("SearchResult");
// } else {
//4.根据特征,查询SknImageVectors索引
searchResult = searchCommonService.doSearch(indexName, searchParam);
JSONObject dataMap = new JSONObject();
dataMap.put("SearchResult", searchResult);
searchCacheService.addJSONObjectToCache(searchCache, indexName, searchParam, dataMap);
}
//}
SearchApiResult searchApiResult = new SearchApiResult();
if (CollectionUtils.isNotEmpty(searchResult.getResultList())) {
List<Map<String, Object>> sknList = getSknImageMap(searchResult.getResultList());
... ...