Authored by hugufei

使用personalVersionManager重构PersonalVectorFeatureSearch

@@ -50,14 +50,14 @@ public class SearchDynamicConfigService { @@ -50,14 +50,14 @@ public class SearchDynamicConfigService {
50 return configReader.getBoolean("search.price.plan.open", true); 50 return configReader.getBoolean("search.price.plan.open", true);
51 } 51 }
52 52
53 - /**  
54 - * 获取个性化搜索特征向量的版本 默认为-1  
55 - *  
56 - * @return  
57 - */  
58 - public String personalizedSearchVersion() {  
59 - return configReader.getString("search.personalized.feature.version", "-1");  
60 - } 53 +// /**
  54 +// * 获取个性化搜索特征向量的版本 默认为-1
  55 +// *
  56 +// * @return
  57 +// */
  58 +// public String personalizedSearchVersion() {
  59 +// return configReader.getString("search.personalized.feature.version", "-1");
  60 +// }
61 61
62 /** 62 /**
63 * 频道降分是否打开 63 * 频道降分是否打开
@@ -5,6 +5,7 @@ import com.yoho.search.common.cache.CacheType; @@ -5,6 +5,7 @@ import com.yoho.search.common.cache.CacheType;
5 import com.yoho.search.common.cache.aop.SearchCacheAble; 5 import com.yoho.search.common.cache.aop.SearchCacheAble;
6 import com.yoho.search.core.personalized.BigDataRedisService; 6 import com.yoho.search.core.personalized.BigDataRedisService;
7 import com.yoho.search.core.personalized.PersonalizedSearch; 7 import com.yoho.search.core.personalized.PersonalizedSearch;
  8 +import com.yoho.search.core.personalized.version.PersonalVersionManager;
8 import com.yoho.search.service.base.SearchDynamicConfigService; 9 import com.yoho.search.service.base.SearchDynamicConfigService;
9 import org.apache.commons.lang3.StringUtils; 10 import org.apache.commons.lang3.StringUtils;
10 import org.slf4j.Logger; 11 import org.slf4j.Logger;
@@ -25,7 +26,7 @@ public class PersonalVectorFeatureSearch { @@ -25,7 +26,7 @@ public class PersonalVectorFeatureSearch {
25 private static final Double FACTOR_CONSTANT = 0.8D; 26 private static final Double FACTOR_CONSTANT = 0.8D;
26 27
27 @Autowired 28 @Autowired
28 - private SearchDynamicConfigService searchDynamicConfigService; 29 + private PersonalVersionManager personalVersionManager;
29 @Autowired 30 @Autowired
30 private BigDataRedisService bigDataRedisService; 31 private BigDataRedisService bigDataRedisService;
31 32
@@ -38,7 +39,7 @@ public class PersonalVectorFeatureSearch { @@ -38,7 +39,7 @@ public class PersonalVectorFeatureSearch {
38 return null; 39 return null;
39 } 40 }
40 // 2. 获取特征向量版本(即生成时间,该时间需要与skn的生成时间一致才有意义) 41 // 2. 获取特征向量版本(即生成时间,该时间需要与skn的生成时间一致才有意义)
41 - String vectorFeatureVersion = searchDynamicConfigService.personalizedSearchVersion(); 42 + String vectorFeatureVersion = personalVersionManager.getCurrentVersionInZk();
42 if (StringUtils.isEmpty(vectorFeatureVersion) || "-1".equals(vectorFeatureVersion)) { 43 if (StringUtils.isEmpty(vectorFeatureVersion) || "-1".equals(vectorFeatureVersion)) {
43 return null; 44 return null;
44 } 45 }
@@ -70,7 +71,7 @@ public class PersonalVectorFeatureSearch { @@ -70,7 +71,7 @@ public class PersonalVectorFeatureSearch {
70 return scoreMap; 71 return scoreMap;
71 } 72 }
72 73
73 - String vectorFeatureVersion = StringUtils.isNotEmpty(version) ? version : searchDynamicConfigService.personalizedSearchVersion(); 74 + String vectorFeatureVersion = StringUtils.isNotEmpty(version) ? version : personalVersionManager.getCurrentVersionInZk();
74 scoreMap.put("vectorFeatureVersion", vectorFeatureVersion); 75 scoreMap.put("vectorFeatureVersion", vectorFeatureVersion);
75 if (StringUtils.isEmpty(vectorFeatureVersion) || "-1".equals(vectorFeatureVersion)) { 76 if (StringUtils.isEmpty(vectorFeatureVersion) || "-1".equals(vectorFeatureVersion)) {
76 return scoreMap; 77 return scoreMap;