Authored by hugufei

使用personalVersionManager重构PersonalVectorFeatureSearch

... ... @@ -50,14 +50,14 @@ public class SearchDynamicConfigService {
return configReader.getBoolean("search.price.plan.open", true);
}
/**
* 获取个性化搜索特征向量的版本 默认为-1
*
* @return
*/
public String personalizedSearchVersion() {
return configReader.getString("search.personalized.feature.version", "-1");
}
// /**
// * 获取个性化搜索特征向量的版本 默认为-1
// *
// * @return
// */
// public String personalizedSearchVersion() {
// return configReader.getString("search.personalized.feature.version", "-1");
// }
/**
* 频道降分是否打开
... ...
... ... @@ -5,6 +5,7 @@ import com.yoho.search.common.cache.CacheType;
import com.yoho.search.common.cache.aop.SearchCacheAble;
import com.yoho.search.core.personalized.BigDataRedisService;
import com.yoho.search.core.personalized.PersonalizedSearch;
import com.yoho.search.core.personalized.version.PersonalVersionManager;
import com.yoho.search.service.base.SearchDynamicConfigService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
... ... @@ -25,7 +26,7 @@ public class PersonalVectorFeatureSearch {
private static final Double FACTOR_CONSTANT = 0.8D;
@Autowired
private SearchDynamicConfigService searchDynamicConfigService;
private PersonalVersionManager personalVersionManager;
@Autowired
private BigDataRedisService bigDataRedisService;
... ... @@ -38,7 +39,7 @@ public class PersonalVectorFeatureSearch {
return null;
}
// 2. 获取特征向量版本(即生成时间,该时间需要与skn的生成时间一致才有意义)
String vectorFeatureVersion = searchDynamicConfigService.personalizedSearchVersion();
String vectorFeatureVersion = personalVersionManager.getCurrentVersionInZk();
if (StringUtils.isEmpty(vectorFeatureVersion) || "-1".equals(vectorFeatureVersion)) {
return null;
}
... ... @@ -70,7 +71,7 @@ public class PersonalVectorFeatureSearch {
return scoreMap;
}
String vectorFeatureVersion = StringUtils.isNotEmpty(version) ? version : searchDynamicConfigService.personalizedSearchVersion();
String vectorFeatureVersion = StringUtils.isNotEmpty(version) ? version : personalVersionManager.getCurrentVersionInZk();
scoreMap.put("vectorFeatureVersion", vectorFeatureVersion);
if (StringUtils.isEmpty(vectorFeatureVersion) || "-1".equals(vectorFeatureVersion)) {
return scoreMap;
... ...