|
|
package com.yoho.search.service.scorer;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yoho.search.core.personalized.BigDataRedisService;
|
|
|
import com.yoho.search.models.FirstShelveTimeScore;
|
|
|
import com.yoho.search.service.base.SearchDynamicConfigService;
|
|
|
import com.yoho.search.service.base.SearchRequestParams;
|
|
|
import com.yoho.search.service.helper.SearchCommonHelper;
|
|
|
import com.yoho.search.service.scorer.impl.*;
|
|
|
import com.yoho.search.service.scorer.personal.PersonalGenderFeatureSearch;
|
|
|
import org.elasticsearch.index.query.QueryBuilder;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
...
|
...
|
@@ -22,7 +24,7 @@ public class SearchScorerFactory { |
|
|
private static final Logger logger = LoggerFactory.getLogger(SearchScorerFactory.class);
|
|
|
|
|
|
@Autowired
|
|
|
private BigDataRedisService bigDataRedisService;
|
|
|
private PersonalGenderFeatureSearch personalGenderFeatureSearch;
|
|
|
@Autowired
|
|
|
private SearchCommonHelper searchCommonHelper;
|
|
|
@Autowired
|
...
|
...
|
@@ -36,18 +38,17 @@ public class SearchScorerFactory { |
|
|
return new GlobalProductScorer();
|
|
|
}
|
|
|
|
|
|
// 获取【断码商品】的打分器
|
|
|
public IScorer getBreakSizeProductScorer(Map<String, String> paramMap) {
|
|
|
try {
|
|
|
List<String> userFavoriteSizes = bigDataRedisService.getUserFavoriteSizes(paramMap.getOrDefault("uid", "0"));
|
|
|
IScorer breakSizeProductScorer = new BreakSizeProductScorer(userFavoriteSizes);
|
|
|
return breakSizeProductScorer;
|
|
|
}catch (Exception e){
|
|
|
logger.error(e.getMessage());
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
// // 获取【断码商品】的打分器
|
|
|
// public IScorer getBreakSizeProductScorer(Map<String, String> paramMap) {
|
|
|
// try {
|
|
|
// List<String> userFavoriteSizes = bigDataRedisService.getUserFavoriteSizes(paramMap.getOrDefault("uid", "0"));
|
|
|
// IScorer breakSizeProductScorer = new BreakSizeProductScorer(userFavoriteSizes);
|
|
|
// return breakSizeProductScorer;
|
|
|
// }catch (Exception e){
|
|
|
// logger.error(e.getMessage());
|
|
|
// return null;
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
// 获取【问题商品】的打分器
|
|
|
public IScorer getProblemProductScorer() {
|
...
|
...
|
@@ -66,7 +67,7 @@ public class SearchScorerFactory { |
|
|
return null;
|
|
|
}
|
|
|
float physicalChannelWeight = (float) dynamicConfig.getDeScorePhysicalChannelWeight();
|
|
|
Map<String, Float> userGenderFloat = bigDataRedisService.getUserGenderFeature(paramMap.getOrDefault("uid", "0"));
|
|
|
JSONObject userGenderFloat = personalGenderFeatureSearch.queryUserGenderFeature(paramMap);
|
|
|
return new UserChannelSearchScorer(paramMap, userGenderFloat, physicalChannelWeight);
|
|
|
}catch (Exception e){
|
|
|
logger.error(e.getMessage());
|
...
|
...
|
@@ -115,7 +116,7 @@ public class SearchScorerFactory { |
|
|
return new CsBrandKeyWordScorer(query);
|
|
|
}
|
|
|
|
|
|
// 获取CsBrandKeyWord的打分器
|
|
|
// 获取特殊店铺的打分器
|
|
|
public IScorer getSpecialShopScorer(List<Integer> shopIds,float weight) {
|
|
|
return new SpecialShopScorer(shopIds,weight);
|
|
|
}
|
...
|
...
|
|