1
|
package com.yoho.search.service.scorer;
|
1
|
package com.yoho.search.service.scorer;
|
2
|
|
2
|
|
|
|
3
|
+import com.alibaba.fastjson.JSONObject;
|
3
|
import com.yoho.search.core.personalized.BigDataRedisService;
|
4
|
import com.yoho.search.core.personalized.BigDataRedisService;
|
4
|
import com.yoho.search.models.FirstShelveTimeScore;
|
5
|
import com.yoho.search.models.FirstShelveTimeScore;
|
5
|
import com.yoho.search.service.base.SearchDynamicConfigService;
|
6
|
import com.yoho.search.service.base.SearchDynamicConfigService;
|
6
|
import com.yoho.search.service.base.SearchRequestParams;
|
7
|
import com.yoho.search.service.base.SearchRequestParams;
|
7
|
import com.yoho.search.service.helper.SearchCommonHelper;
|
8
|
import com.yoho.search.service.helper.SearchCommonHelper;
|
8
|
import com.yoho.search.service.scorer.impl.*;
|
9
|
import com.yoho.search.service.scorer.impl.*;
|
|
|
10
|
+import com.yoho.search.service.scorer.personal.PersonalGenderFeatureSearch;
|
9
|
import org.elasticsearch.index.query.QueryBuilder;
|
11
|
import org.elasticsearch.index.query.QueryBuilder;
|
10
|
import org.slf4j.Logger;
|
12
|
import org.slf4j.Logger;
|
11
|
import org.slf4j.LoggerFactory;
|
13
|
import org.slf4j.LoggerFactory;
|
|
@@ -22,7 +24,7 @@ public class SearchScorerFactory { |
|
@@ -22,7 +24,7 @@ public class SearchScorerFactory { |
22
|
private static final Logger logger = LoggerFactory.getLogger(SearchScorerFactory.class);
|
24
|
private static final Logger logger = LoggerFactory.getLogger(SearchScorerFactory.class);
|
23
|
|
25
|
|
24
|
@Autowired
|
26
|
@Autowired
|
25
|
- private BigDataRedisService bigDataRedisService;
|
27
|
+ private PersonalGenderFeatureSearch personalGenderFeatureSearch;
|
26
|
@Autowired
|
28
|
@Autowired
|
27
|
private SearchCommonHelper searchCommonHelper;
|
29
|
private SearchCommonHelper searchCommonHelper;
|
28
|
@Autowired
|
30
|
@Autowired
|
|
@@ -36,18 +38,17 @@ public class SearchScorerFactory { |
|
@@ -36,18 +38,17 @@ public class SearchScorerFactory { |
36
|
return new GlobalProductScorer();
|
38
|
return new GlobalProductScorer();
|
37
|
}
|
39
|
}
|
38
|
|
40
|
|
39
|
- // 获取【断码商品】的打分器
|
|
|
40
|
- public IScorer getBreakSizeProductScorer(Map<String, String> paramMap) {
|
|
|
41
|
- try {
|
|
|
42
|
- List<String> userFavoriteSizes = bigDataRedisService.getUserFavoriteSizes(paramMap.getOrDefault("uid", "0"));
|
|
|
43
|
- IScorer breakSizeProductScorer = new BreakSizeProductScorer(userFavoriteSizes);
|
|
|
44
|
- return breakSizeProductScorer;
|
|
|
45
|
- }catch (Exception e){
|
|
|
46
|
- logger.error(e.getMessage());
|
|
|
47
|
- return null;
|
|
|
48
|
- }
|
|
|
49
|
-
|
|
|
50
|
- }
|
41
|
+// // 获取【断码商品】的打分器
|
|
|
42
|
+// public IScorer getBreakSizeProductScorer(Map<String, String> paramMap) {
|
|
|
43
|
+// try {
|
|
|
44
|
+// List<String> userFavoriteSizes = bigDataRedisService.getUserFavoriteSizes(paramMap.getOrDefault("uid", "0"));
|
|
|
45
|
+// IScorer breakSizeProductScorer = new BreakSizeProductScorer(userFavoriteSizes);
|
|
|
46
|
+// return breakSizeProductScorer;
|
|
|
47
|
+// }catch (Exception e){
|
|
|
48
|
+// logger.error(e.getMessage());
|
|
|
49
|
+// return null;
|
|
|
50
|
+// }
|
|
|
51
|
+// }
|
51
|
|
52
|
|
52
|
// 获取【问题商品】的打分器
|
53
|
// 获取【问题商品】的打分器
|
53
|
public IScorer getProblemProductScorer() {
|
54
|
public IScorer getProblemProductScorer() {
|
|
@@ -66,7 +67,7 @@ public class SearchScorerFactory { |
|
@@ -66,7 +67,7 @@ public class SearchScorerFactory { |
66
|
return null;
|
67
|
return null;
|
67
|
}
|
68
|
}
|
68
|
float physicalChannelWeight = (float) dynamicConfig.getDeScorePhysicalChannelWeight();
|
69
|
float physicalChannelWeight = (float) dynamicConfig.getDeScorePhysicalChannelWeight();
|
69
|
- Map<String, Float> userGenderFloat = bigDataRedisService.getUserGenderFeature(paramMap.getOrDefault("uid", "0"));
|
70
|
+ JSONObject userGenderFloat = personalGenderFeatureSearch.queryUserGenderFeature(paramMap);
|
70
|
return new UserChannelSearchScorer(paramMap, userGenderFloat, physicalChannelWeight);
|
71
|
return new UserChannelSearchScorer(paramMap, userGenderFloat, physicalChannelWeight);
|
71
|
}catch (Exception e){
|
72
|
}catch (Exception e){
|
72
|
logger.error(e.getMessage());
|
73
|
logger.error(e.getMessage());
|
|
@@ -115,7 +116,7 @@ public class SearchScorerFactory { |
|
@@ -115,7 +116,7 @@ public class SearchScorerFactory { |
115
|
return new CsBrandKeyWordScorer(query);
|
116
|
return new CsBrandKeyWordScorer(query);
|
116
|
}
|
117
|
}
|
117
|
|
118
|
|
118
|
- // 获取CsBrandKeyWord的打分器
|
119
|
+ // 获取特殊店铺的打分器
|
119
|
public IScorer getSpecialShopScorer(List<Integer> shopIds,float weight) {
|
120
|
public IScorer getSpecialShopScorer(List<Integer> shopIds,float weight) {
|
120
|
return new SpecialShopScorer(shopIds,weight);
|
121
|
return new SpecialShopScorer(shopIds,weight);
|
121
|
}
|
122
|
}
|