|
@@ -126,14 +126,12 @@ public class SortRecallSceneService extends AbstractRecallService { |
|
@@ -126,14 +126,12 @@ public class SortRecallSceneService extends AbstractRecallService { |
126
|
// 2)获取商品列表
|
126
|
// 2)获取商品列表
|
127
|
long begin = System.currentTimeMillis();
|
127
|
long begin = System.currentTimeMillis();
|
128
|
RecallProductInfoList recallProductInfoList = this.queryRecallProductInfoList(paramMap, page, pageSize);
|
128
|
RecallProductInfoList recallProductInfoList = this.queryRecallProductInfoList(paramMap, page, pageSize);
|
129
|
- logger.warn("[func1=queryRealProductList][cost={}]", System.currentTimeMillis() - begin);
|
129
|
+ logger.info("[func1=queryRealProductList][cost={}]", System.currentTimeMillis() - begin);
|
130
|
|
130
|
|
131
|
// 3)填充变价计划,并做品牌打散
|
131
|
// 3)填充变价计划,并做品牌打散
|
132
|
begin = System.currentTimeMillis();
|
132
|
begin = System.currentTimeMillis();
|
133
|
List<Map<String, Object>> product_list = productIndexBaseService.getProductListWithPricePlan(recallProductInfoList.getProductInfoList());
|
133
|
List<Map<String, Object>> product_list = productIndexBaseService.getProductListWithPricePlan(recallProductInfoList.getProductInfoList());
|
134
|
- // product_list =
|
|
|
135
|
- // productListSortService.sortProductList(product_list, paramMap);
|
|
|
136
|
- logger.warn("[func2=getProductListWithPricePlan][cost={}]", System.currentTimeMillis() - begin);
|
134
|
+ logger.info("[func2=getProductListWithPricePlan][cost={}]", System.currentTimeMillis() - begin);
|
137
|
|
135
|
|
138
|
// 4)构造返回结果
|
136
|
// 4)构造返回结果
|
139
|
JSONObject dataMap = new JSONObject();
|
137
|
JSONObject dataMap = new JSONObject();
|
|
@@ -201,7 +199,7 @@ public class SortRecallSceneService extends AbstractRecallService { |
|
@@ -201,7 +199,7 @@ public class SortRecallSceneService extends AbstractRecallService { |
201
|
}
|
199
|
}
|
202
|
realResults.add(productMap.get(produtSkn));
|
200
|
realResults.add(productMap.get(produtSkn));
|
203
|
}
|
201
|
}
|
204
|
- logger.warn("[func=queryProductListWithSort][query by sknList][resultsize is {}][cost={}]", productList.size(), System.currentTimeMillis() - begin);
|
202
|
+ logger.info("[func=queryProductListWithSort][query by sknList][resultsize is {}][cost={}]", productList.size(), System.currentTimeMillis() - begin);
|
205
|
return realResults;
|
203
|
return realResults;
|
206
|
}
|
204
|
}
|
207
|
|
205
|
|
|
@@ -236,7 +234,7 @@ public class SortRecallSceneService extends AbstractRecallService { |
|
@@ -236,7 +234,7 @@ public class SortRecallSceneService extends AbstractRecallService { |
236
|
|
234
|
|
237
|
// 4、查询es
|
235
|
// 4、查询es
|
238
|
SearchResult searchResult = searchCommonService.doSearch(ISearchConstants.INDEX_NAME_PRODUCT_INDEX, searchParam);
|
236
|
SearchResult searchResult = searchCommonService.doSearch(ISearchConstants.INDEX_NAME_PRODUCT_INDEX, searchParam);
|
239
|
- logger.warn("[func=queryProductListWithDefault][resultsize is {}][cost={}]", searchResult.getTotal(), System.currentTimeMillis() - begin);
|
237
|
+ logger.info("[func=queryProductListWithDefault][resultsize is {}][cost={}]", searchResult.getTotal(), System.currentTimeMillis() - begin);
|
240
|
return searchResult.getResultList();
|
238
|
return searchResult.getResultList();
|
241
|
}
|
239
|
}
|
242
|
|
240
|
|
|
@@ -258,13 +256,13 @@ public class SortRecallSceneService extends AbstractRecallService { |
|
@@ -258,13 +256,13 @@ public class SortRecallSceneService extends AbstractRecallService { |
258
|
String uid = MapUtils.getString(paramMap, "uid", "0");
|
256
|
String uid = MapUtils.getString(paramMap, "uid", "0");
|
259
|
String vectorFeatureVersion = searchDynamicConfigService.personalizedSearchVersion();
|
257
|
String vectorFeatureVersion = searchDynamicConfigService.personalizedSearchVersion();
|
260
|
String userGlobalBrandIds = bigDataRedisService.getUserGlobalFaveriteBrand(uid, vectorFeatureVersion);
|
258
|
String userGlobalBrandIds = bigDataRedisService.getUserGlobalFaveriteBrand(uid, vectorFeatureVersion);
|
261
|
- logger.warn("uid is [{}],vectorFeatureVersion is [{}], userGlobalBrandIds is [{}]", uid, vectorFeatureVersion, userGlobalBrandIds);
|
259
|
+ logger.info("uid is [{}],vectorFeatureVersion is [{}], userGlobalBrandIds is [{}]", uid, vectorFeatureVersion, userGlobalBrandIds);
|
262
|
JSONArray brandJsonArray = JSON.parseArray(userGlobalBrandIds);
|
260
|
JSONArray brandJsonArray = JSON.parseArray(userGlobalBrandIds);
|
263
|
List<Integer> results = new ArrayList<Integer>();
|
261
|
List<Integer> results = new ArrayList<Integer>();
|
264
|
for (int i = 0; i < brandJsonArray.size(); i++) {
|
262
|
for (int i = 0; i < brandJsonArray.size(); i++) {
|
265
|
results.add(Integer.valueOf(brandJsonArray.getString(i)));
|
263
|
results.add(Integer.valueOf(brandJsonArray.getString(i)));
|
266
|
}
|
264
|
}
|
267
|
- logger.warn("[getUserGlobalBrandIds,uid is[{}], brandIds is [{}] ]", uid, results);
|
265
|
+ logger.info("[getUserGlobalBrandIds,uid is[{}], brandIds is [{}] ]", uid, results);
|
268
|
return results;
|
266
|
return results;
|
269
|
} catch (Exception e) {
|
267
|
} catch (Exception e) {
|
270
|
logger.error(e.getMessage(), e);
|
268
|
logger.error(e.getMessage(), e);
|
|
@@ -330,7 +328,7 @@ public class SortRecallSceneService extends AbstractRecallService { |
|
@@ -330,7 +328,7 @@ public class SortRecallSceneService extends AbstractRecallService { |
330
|
for (Map<String, Object> result : results) {
|
328
|
for (Map<String, Object> result : results) {
|
331
|
brandIds.add(MapUtils.getInteger(result, "id"));
|
329
|
brandIds.add(MapUtils.getInteger(result, "id"));
|
332
|
}
|
330
|
}
|
333
|
- logger.warn("[getUserLikeBrandIds,uid is[{}], brandIds is [{}] ]", uid, brandIds);
|
331
|
+ logger.info("[getUserLikeBrandIds,uid is[{}], brandIds is [{}] ]", uid, brandIds);
|
334
|
return brandIds;
|
332
|
return brandIds;
|
335
|
} catch (Exception e) {
|
333
|
} catch (Exception e) {
|
336
|
logger.error(e.getMessage(), e);
|
334
|
logger.error(e.getMessage(), e);
|
|
@@ -349,8 +347,12 @@ public class SortRecallSceneService extends AbstractRecallService { |
|
@@ -349,8 +347,12 @@ public class SortRecallSceneService extends AbstractRecallService { |
349
|
List<IRecallStrategy> recallStrategy = new ArrayList<IRecallStrategy>();
|
347
|
List<IRecallStrategy> recallStrategy = new ArrayList<IRecallStrategy>();
|
350
|
int pageSize = this.getPageSize(paramMap);
|
348
|
int pageSize = this.getPageSize(paramMap);
|
351
|
// 0、获取用户偏好品牌
|
349
|
// 0、获取用户偏好品牌
|
352
|
- // List<Integer> brandIds = this.getUserGlobalBrandIds(paramMap);
|
|
|
353
|
- List<Integer> brandIds = this.getUserLikeBrandIds(paramMap);
|
350
|
+ List<Integer> brandIds = null;
|
|
|
351
|
+ if(searchDynamicConfigService.isSortPageRecallUseGlobalBrand()){
|
|
|
352
|
+ brandIds = this.getUserGlobalBrandIds(paramMap);
|
|
|
353
|
+ }else{
|
|
|
354
|
+ brandIds = this.getUserLikeBrandIds(paramMap);
|
|
|
355
|
+ }
|
354
|
// 1、支持firstProductSkn的召回
|
356
|
// 1、支持firstProductSkn的召回
|
355
|
recallStrategy.add(new FirstProductSknStrategy(1, this.getFirstProductSkns(paramMap)));
|
357
|
recallStrategy.add(new FirstProductSknStrategy(1, this.getFirstProductSkns(paramMap)));
|
356
|
// 2、支持直通车的召回-随机召回
|
358
|
// 2、支持直通车的召回-随机召回
|
|
@@ -383,7 +385,7 @@ public class SortRecallSceneService extends AbstractRecallService { |
|
@@ -383,7 +385,7 @@ public class SortRecallSceneService extends AbstractRecallService { |
383
|
protected RecallResult doSketchyRank(Map<String, String> paramMap, RecallResult recallResult) {
|
385
|
protected RecallResult doSketchyRank(Map<String, String> paramMap, RecallResult recallResult) {
|
384
|
Set<String> existProductSkns = new HashSet<String>();
|
386
|
Set<String> existProductSkns = new HashSet<String>();
|
385
|
for (RecallSearchResult recallSearchResult : recallResult.getRecallSearchResult()) {
|
387
|
for (RecallSearchResult recallSearchResult : recallResult.getRecallSearchResult()) {
|
386
|
- logger.warn("[func=doSketchyRank][type={}][results={}]", recallSearchResult.getRecallType(), recallSearchResult.getResultList().size());
|
388
|
+ logger.info("[func=doSketchyRank][type={}][results={}]", recallSearchResult.getRecallType(), recallSearchResult.getResultList().size());
|
387
|
Iterator<Map<String, Object>> iterator = recallSearchResult.getResultList().iterator();
|
389
|
Iterator<Map<String, Object>> iterator = recallSearchResult.getResultList().iterator();
|
388
|
while (iterator.hasNext()) {
|
390
|
while (iterator.hasNext()) {
|
389
|
Map<String, Object> product = iterator.next();
|
391
|
Map<String, Object> product = iterator.next();
|
|
@@ -403,7 +405,7 @@ public class SortRecallSceneService extends AbstractRecallService { |
|
@@ -403,7 +405,7 @@ public class SortRecallSceneService extends AbstractRecallService { |
403
|
// 1、数据组装
|
405
|
// 1、数据组装
|
404
|
List<Map<String, Object>> productList = new ArrayList<Map<String, Object>>();
|
406
|
List<Map<String, Object>> productList = new ArrayList<Map<String, Object>>();
|
405
|
for (RecallSearchResult recallSearchResult : recallResult.getRecallSearchResult()) {
|
407
|
for (RecallSearchResult recallSearchResult : recallResult.getRecallSearchResult()) {
|
406
|
- logger.warn("[func=doCarefulRank][type={}][results={}]", recallSearchResult.getRecallType(), recallSearchResult.getResultList().size());
|
408
|
+ logger.info("[func=doCarefulRank][type={}][results={}]", recallSearchResult.getRecallType(), recallSearchResult.getResultList().size());
|
407
|
for (Map<String, Object> product : recallSearchResult.getResultList()) {
|
409
|
for (Map<String, Object> product : recallSearchResult.getResultList()) {
|
408
|
product.put("recallType", recallSearchResult.getRecallType());
|
410
|
product.put("recallType", recallSearchResult.getRecallType());
|
409
|
productList.add(product);
|
411
|
productList.add(product);
|
|
@@ -462,7 +464,7 @@ public class SortRecallSceneService extends AbstractRecallService { |
|
@@ -462,7 +464,7 @@ public class SortRecallSceneService extends AbstractRecallService { |
462
|
int count = newProductList.size();
|
464
|
int count = newProductList.size();
|
463
|
int maxPage = count / pageSize;
|
465
|
int maxPage = count / pageSize;
|
464
|
recallResult.setProductList(newProductList.subList(0, maxPage * pageSize));
|
466
|
recallResult.setProductList(newProductList.subList(0, maxPage * pageSize));
|
465
|
- logger.warn("[func=doReRank][total product size is ={}]", recallResult.getProductList().size());
|
467
|
+ logger.info("[func=doReRank][total product size is ={}]", recallResult.getProductList().size());
|
466
|
return recallResult;
|
468
|
return recallResult;
|
467
|
}
|
469
|
}
|
468
|
|
470
|
|