...
|
...
|
@@ -82,7 +82,8 @@ public class GoodProductListService implements IGoodProductsService { |
|
|
List<Integer> smallSortIds = this.getProductSknSmallSortIds(paramMap, maxSmallSortCount);
|
|
|
// 3、再每个品类下获取5个SKN
|
|
|
List<String> recommondSkns = this.getRecommondedSkns(smallSortIds, maxProductSknCountPerSort, paramMap);
|
|
|
|
|
|
Collections.shuffle(recommondSkns);
|
|
|
|
|
|
// 4、构造搜索参数
|
|
|
SearchParam searchParam = new SearchParam();
|
|
|
searchParam.setFiter(this.getDefaultBoolQueryBuilder());
|
...
|
...
|
@@ -126,11 +127,11 @@ public class GoodProductListService implements IGoodProductsService { |
|
|
private QueryBuilder builderGoodProductQueryBuilder(Map<String, String> paramMap, List<String> recommendedSknList) {
|
|
|
QueryBuilder queryBuilder = QueryBuilders.matchAllQuery();
|
|
|
FunctionScoreQueryBuilder functionScoreQueryBuilder = new FunctionScoreQueryBuilder(queryBuilder);
|
|
|
// 针对参数里第一个SKN加分
|
|
|
String productSkns = paramMap.get(SearchRequestParams.PARAM_SYNC_SKN);
|
|
|
if (!StringUtils.isBlank(productSkns)) {
|
|
|
functionScoreQueryBuilder.add(QueryBuilders.termsQuery("productSkn", productSkns.split(",")[0]), ScoreFunctionBuilders.weightFactorFunction(firstSknScore));
|
|
|
}
|
|
|
// // 针对参数里第一个SKN加分
|
|
|
// String productSkns = paramMap.get(SearchRequestParams.PARAM_SYNC_SKN);
|
|
|
// if (!StringUtils.isBlank(productSkns)) {
|
|
|
// functionScoreQueryBuilder.add(QueryBuilders.termsQuery("productSkn", productSkns.split(",")[0]), ScoreFunctionBuilders.weightFactorFunction(firstSknScore));
|
|
|
// }
|
|
|
// 针对推荐出来的SKN做加分
|
|
|
if (recommendedSknList != null && !recommendedSknList.isEmpty()) {
|
|
|
Map<Integer, List<String>> recommondSknMap = this.splitProductSkns(recommendedSknList, maxCountPerGroup);
|
...
|
...
|
@@ -333,7 +334,6 @@ public class GoodProductListService implements IGoodProductsService { |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
Collections.shuffle(recommendedSknList);
|
|
|
return recommendedSknList;
|
|
|
}
|
|
|
|
...
|
...
|
|