|
|
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));
|
|
|
}
|
|
|
} |
...
|
...
|
|