...
|
...
|
@@ -126,14 +126,12 @@ public class SortRecallSceneService extends AbstractRecallService { |
|
|
// 2)获取商品列表
|
|
|
long begin = System.currentTimeMillis();
|
|
|
RecallProductInfoList recallProductInfoList = this.queryRecallProductInfoList(paramMap, page, pageSize);
|
|
|
logger.warn("[func1=queryRealProductList][cost={}]", System.currentTimeMillis() - begin);
|
|
|
logger.info("[func1=queryRealProductList][cost={}]", System.currentTimeMillis() - begin);
|
|
|
|
|
|
// 3)填充变价计划,并做品牌打散
|
|
|
begin = System.currentTimeMillis();
|
|
|
List<Map<String, Object>> product_list = productIndexBaseService.getProductListWithPricePlan(recallProductInfoList.getProductInfoList());
|
|
|
// product_list =
|
|
|
// productListSortService.sortProductList(product_list, paramMap);
|
|
|
logger.warn("[func2=getProductListWithPricePlan][cost={}]", System.currentTimeMillis() - begin);
|
|
|
logger.info("[func2=getProductListWithPricePlan][cost={}]", System.currentTimeMillis() - begin);
|
|
|
|
|
|
// 4)构造返回结果
|
|
|
JSONObject dataMap = new JSONObject();
|
...
|
...
|
@@ -201,7 +199,7 @@ public class SortRecallSceneService extends AbstractRecallService { |
|
|
}
|
|
|
realResults.add(productMap.get(produtSkn));
|
|
|
}
|
|
|
logger.warn("[func=queryProductListWithSort][query by sknList][resultsize is {}][cost={}]", productList.size(), System.currentTimeMillis() - begin);
|
|
|
logger.info("[func=queryProductListWithSort][query by sknList][resultsize is {}][cost={}]", productList.size(), System.currentTimeMillis() - begin);
|
|
|
return realResults;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -236,7 +234,7 @@ public class SortRecallSceneService extends AbstractRecallService { |
|
|
|
|
|
// 4、查询es
|
|
|
SearchResult searchResult = searchCommonService.doSearch(ISearchConstants.INDEX_NAME_PRODUCT_INDEX, searchParam);
|
|
|
logger.warn("[func=queryProductListWithDefault][resultsize is {}][cost={}]", searchResult.getTotal(), System.currentTimeMillis() - begin);
|
|
|
logger.info("[func=queryProductListWithDefault][resultsize is {}][cost={}]", searchResult.getTotal(), System.currentTimeMillis() - begin);
|
|
|
return searchResult.getResultList();
|
|
|
}
|
|
|
|
...
|
...
|
@@ -258,13 +256,13 @@ public class SortRecallSceneService extends AbstractRecallService { |
|
|
String uid = MapUtils.getString(paramMap, "uid", "0");
|
|
|
String vectorFeatureVersion = searchDynamicConfigService.personalizedSearchVersion();
|
|
|
String userGlobalBrandIds = bigDataRedisService.getUserGlobalFaveriteBrand(uid, vectorFeatureVersion);
|
|
|
logger.warn("uid is [{}],vectorFeatureVersion is [{}], userGlobalBrandIds is [{}]", uid, vectorFeatureVersion, userGlobalBrandIds);
|
|
|
logger.info("uid is [{}],vectorFeatureVersion is [{}], userGlobalBrandIds is [{}]", uid, vectorFeatureVersion, userGlobalBrandIds);
|
|
|
JSONArray brandJsonArray = JSON.parseArray(userGlobalBrandIds);
|
|
|
List<Integer> results = new ArrayList<Integer>();
|
|
|
for (int i = 0; i < brandJsonArray.size(); i++) {
|
|
|
results.add(Integer.valueOf(brandJsonArray.getString(i)));
|
|
|
}
|
|
|
logger.warn("[getUserGlobalBrandIds,uid is[{}], brandIds is [{}] ]", uid, results);
|
|
|
logger.info("[getUserGlobalBrandIds,uid is[{}], brandIds is [{}] ]", uid, results);
|
|
|
return results;
|
|
|
} catch (Exception e) {
|
|
|
logger.error(e.getMessage(), e);
|
...
|
...
|
@@ -330,7 +328,7 @@ public class SortRecallSceneService extends AbstractRecallService { |
|
|
for (Map<String, Object> result : results) {
|
|
|
brandIds.add(MapUtils.getInteger(result, "id"));
|
|
|
}
|
|
|
logger.warn("[getUserLikeBrandIds,uid is[{}], brandIds is [{}] ]", uid, brandIds);
|
|
|
logger.info("[getUserLikeBrandIds,uid is[{}], brandIds is [{}] ]", uid, brandIds);
|
|
|
return brandIds;
|
|
|
} catch (Exception e) {
|
|
|
logger.error(e.getMessage(), e);
|
...
|
...
|
@@ -349,8 +347,12 @@ public class SortRecallSceneService extends AbstractRecallService { |
|
|
List<IRecallStrategy> recallStrategy = new ArrayList<IRecallStrategy>();
|
|
|
int pageSize = this.getPageSize(paramMap);
|
|
|
// 0、获取用户偏好品牌
|
|
|
// List<Integer> brandIds = this.getUserGlobalBrandIds(paramMap);
|
|
|
List<Integer> brandIds = this.getUserLikeBrandIds(paramMap);
|
|
|
List<Integer> brandIds = null;
|
|
|
if(searchDynamicConfigService.isSortPageRecallUseGlobalBrand()){
|
|
|
brandIds = this.getUserGlobalBrandIds(paramMap);
|
|
|
}else{
|
|
|
brandIds = this.getUserLikeBrandIds(paramMap);
|
|
|
}
|
|
|
// 1、支持firstProductSkn的召回
|
|
|
recallStrategy.add(new FirstProductSknStrategy(1, this.getFirstProductSkns(paramMap)));
|
|
|
// 2、支持直通车的召回-随机召回
|
...
|
...
|
@@ -383,7 +385,7 @@ public class SortRecallSceneService extends AbstractRecallService { |
|
|
protected RecallResult doSketchyRank(Map<String, String> paramMap, RecallResult recallResult) {
|
|
|
Set<String> existProductSkns = new HashSet<String>();
|
|
|
for (RecallSearchResult recallSearchResult : recallResult.getRecallSearchResult()) {
|
|
|
logger.warn("[func=doSketchyRank][type={}][results={}]", recallSearchResult.getRecallType(), recallSearchResult.getResultList().size());
|
|
|
logger.info("[func=doSketchyRank][type={}][results={}]", recallSearchResult.getRecallType(), recallSearchResult.getResultList().size());
|
|
|
Iterator<Map<String, Object>> iterator = recallSearchResult.getResultList().iterator();
|
|
|
while (iterator.hasNext()) {
|
|
|
Map<String, Object> product = iterator.next();
|
...
|
...
|
@@ -403,7 +405,7 @@ public class SortRecallSceneService extends AbstractRecallService { |
|
|
// 1、数据组装
|
|
|
List<Map<String, Object>> productList = new ArrayList<Map<String, Object>>();
|
|
|
for (RecallSearchResult recallSearchResult : recallResult.getRecallSearchResult()) {
|
|
|
logger.warn("[func=doCarefulRank][type={}][results={}]", recallSearchResult.getRecallType(), recallSearchResult.getResultList().size());
|
|
|
logger.info("[func=doCarefulRank][type={}][results={}]", recallSearchResult.getRecallType(), recallSearchResult.getResultList().size());
|
|
|
for (Map<String, Object> product : recallSearchResult.getResultList()) {
|
|
|
product.put("recallType", recallSearchResult.getRecallType());
|
|
|
productList.add(product);
|
...
|
...
|
@@ -462,7 +464,7 @@ public class SortRecallSceneService extends AbstractRecallService { |
|
|
int count = newProductList.size();
|
|
|
int maxPage = count / pageSize;
|
|
|
recallResult.setProductList(newProductList.subList(0, maxPage * pageSize));
|
|
|
logger.warn("[func=doReRank][total product size is ={}]", recallResult.getProductList().size());
|
|
|
logger.info("[func=doReRank][total product size is ={}]", recallResult.getProductList().size());
|
|
|
return recallResult;
|
|
|
}
|
|
|
|
...
|
...
|
|