|
|
1
|
+package com.yoho.search.service.scorer.impl;
|
|
|
2
|
+
|
|
|
3
|
+import com.yoho.search.base.utils.ProductIndexEsField;
|
|
|
4
|
+import com.yoho.search.models.YohoFilterFunctionBuilders;
|
|
|
5
|
+import com.yoho.search.service.scorer.IScorer;
|
|
|
6
|
+import org.elasticsearch.index.query.QueryBuilders;
|
|
|
7
|
+import org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders;
|
|
|
8
|
+
|
|
|
9
|
+import java.util.Arrays;
|
|
|
10
|
+
|
|
|
11
|
+/**
|
|
|
12
|
+ * 仅线下可售商品打分器
|
|
|
13
|
+ */
|
|
|
14
|
+public class OfflineSaleOnlyScorer implements IScorer {
|
|
|
15
|
+
|
|
|
16
|
+ private static final float OFFLINE_SALE_ONLY_WEIGHT = 0.90f;// 仅线下可售商品商品
|
|
|
17
|
+
|
|
|
18
|
+ @Override
|
|
|
19
|
+ public void addScorer(YohoFilterFunctionBuilders yohoFilterFunctionBuilders) {
|
|
|
20
|
+ yohoFilterFunctionBuilders.add(QueryBuilders.termsQuery(ProductIndexEsField.storeShowStatus, Arrays.asList("3", "4")), ScoreFunctionBuilders.weightFactorFunction(OFFLINE_SALE_ONLY_WEIGHT));
|
|
|
21
|
+ }
|
|
|
22
|
+} |