Authored by 胡古飞

针对SKN加分

... ... @@ -62,10 +62,12 @@ public class FunctionScoreSearchHelper {
private static final float BRAND_INCREASE_SCORE_WEIGHT = 1.1f;// 品类列表默认针对某些品牌加分
private static final float BRAND_SORT_INCREASE_SCORE_WEIGHT = 1.1f; // 针对特定的【品牌+品类】加分
private static final float SKN_INCREASE_SCORE_WEIGHT = 1.1f;
private static final float BREAK_PRODUCT_WEIGHT = 0.50f;// 断码区商品得分
private static final float GLOABL_DEFUT_WEIGHT = 0.50f;// 全球购得分
private static final float PROBLEM_GOODS_WEIGHT = 0.2f;// 一高三低商品降分
public QueryBuilder buildFunctionScoreQueryBuild(QueryBuilder queryBuilder, BoolQueryBuilder boolQueryBuilder, Map<String, String> paramMap) {
FunctionScoreQueryBuilder functionScoreQueryBuilder = new FunctionScoreQueryBuilder(queryBuilder);
... ... @@ -97,6 +99,10 @@ public class FunctionScoreSearchHelper {
// 7、新品到着的人气值排序,使用人气值当分数,并且针对30天以内的商品做降分
this.addNewArriveHeatDescSearch(functionScoreQueryBuilder, paramMap);
// 8、针对SKN加分
this.addIncreaseScoreSkns(functionScoreQueryBuilder);
functionScoreQueryBuilder.boostMode(CombineFunction.MULT);
return functionScoreQueryBuilder;
... ... @@ -207,6 +213,16 @@ public class FunctionScoreSearchHelper {
logger.warn("Parse score rule [" + ruleValue + "] failed!", e);
}
}
//对skn加分
private void addIncreaseScoreSkns(FunctionScoreQueryBuilder functionScoreQueryBuilder) {
String skns = dynamicConfig.getIncreaseScoreSkns();
if (StringUtils.isBlank(skns) || "-1".equals(skns)) {
return;
}
String[] sknsArr = skns.split(",");
functionScoreQueryBuilder.add(QueryBuilders.termsQuery(ProductIndexEsField.productSkn, sknsArr), ScoreFunctionBuilders.weightFactorFunction(SKN_INCREASE_SCORE_WEIGHT));
}
// 针对问题商品降分【非新品,且是一高三低0交际】
private void addProblemProductSearch(FunctionScoreQueryBuilder functionScoreQueryBuilder, Map<String, String> paramMap) {
... ...