Authored by hugufei

模糊搜索时,仅线下可售商品降权

package com.yoho.search.service.scorer.impl;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.models.YohoFilterFunctionBuilders;
import com.yoho.search.service.scorer.IScorer;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders;
import java.util.Arrays;
/**
* 仅线下可售商品打分器
*/
public class OfflineSaleOnlyScorer implements IScorer {
private static final float OFFLINE_SALE_ONLY_WEIGHT = 0.90f;// 仅线下可售商品商品
@Override
public void addScorer(YohoFilterFunctionBuilders yohoFilterFunctionBuilders) {
yohoFilterFunctionBuilders.add(QueryBuilders.termsQuery(ProductIndexEsField.storeShowStatus, Arrays.asList("3", "4")), ScoreFunctionBuilders.weightFactorFunction(OFFLINE_SALE_ONLY_WEIGHT));
}
}
... ...
... ... @@ -88,7 +88,6 @@ public class UserChannelSearchScorer implements IScorer {
/**
* 获取将要降分的性别权重
*
* @param uid
* @param baseScore
* @param descoreGender
* @return
... ...