Authored by unknown

fix 召回机制的bug

... ... @@ -10,7 +10,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yoho.search.base.utils.ISearchConstants;
import com.yoho.search.common.cache.SearchCacheMatchLogger;
... ... @@ -85,7 +84,7 @@ public class SceneProductListService extends AbstractCacheAbleService {
return new SearchApiResult().setData(dataMap);
} catch (Exception e) {
logger.error(e.getMessage(), e);
return new SearchApiResult().setCode(500).setMessage("scene productList exception").setData(new JSONArray());
return new SearchApiResult().setCode(500).setMessage("scene productList exception").setData(new JSONObject());
}
}
... ...
... ... @@ -2,7 +2,6 @@ package com.yoho.search.service.scene.recall;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
... ... @@ -140,7 +139,7 @@ public class SortRecallSceneService extends AbstractRecallService {
return new SearchApiResult().setData(dataMap);
} catch (Exception e) {
logger.error(e.getMessage(), e);
return new SearchApiResult().setData(null).setMessage("SortProductList Exception").setCode(500);
return new SearchApiResult().setData(new JSONObject()).setMessage("SortProductList Exception").setCode(500);
}
}
... ... @@ -249,16 +248,21 @@ public class SortRecallSceneService extends AbstractRecallService {
}
private List<Integer> getUserGlobalBrandIds(Map<String, String> paramMap) {
String uid = MapUtils.getString(paramMap, "uid", "0");
String vectorFeatureVersion = searchDynamicConfigService.personalizedSearchVersion();
String userVectorFeature = bigDataRedisService.getUserBrandVectorFeature(uid, vectorFeatureVersion);
JSONArray jsonArray = JSON.parseArray(userVectorFeature);
List<Integer> results = new ArrayList<Integer>();
for (int i = 0; i < jsonArray.size(); i++) {
results.add(Integer.valueOf(jsonArray.getString(i)));
try {
String uid = MapUtils.getString(paramMap, "uid", "0");
String vectorFeatureVersion = searchDynamicConfigService.personalizedSearchVersion();
String userVectorFeature = bigDataRedisService.getUserBrandVectorFeature(uid, vectorFeatureVersion);
JSONArray jsonArray = JSON.parseArray(userVectorFeature);
List<Integer> results = new ArrayList<Integer>();
for (int i = 0; i < jsonArray.size(); i++) {
results.add(Integer.valueOf(jsonArray.getString(i)));
}
logger.warn("[getUserGlobalBrandIds,uid is[{}], brandId is [{}] ]", uid, results);
return results;
} catch (Exception e) {
logger.error(e.getMessage(), e);
return new ArrayList<Integer>();
}
logger.warn("[getUserGlobalBrandIds,uid is[{}], brandId is [{}] ]", uid, results);
return results;
}
/**
... ...