...
|
...
|
@@ -3,8 +3,8 @@ package com.yoho.search.recall.scene.beans.persional; |
|
|
import com.yoho.search.core.personalized.models.SortBrand;
|
|
|
import com.yoho.search.core.personalized.models.SortPriceAreas;
|
|
|
import com.yoho.search.core.personalized.models.UserPersonalFactorRspNew;
|
|
|
import com.yoho.search.recall.scene.config.RecallCommonConfigService;
|
|
|
import com.yoho.search.recall.scene.beans.vector.SortBrandVectorComponent;
|
|
|
import com.yoho.search.recall.scene.constants.RecallCommonConstants;
|
|
|
import com.yoho.search.recall.scene.models.personal.PagePersonalFactor;
|
|
|
import com.yoho.search.recall.scene.models.personal.UserPersonalFactor;
|
|
|
import com.yoho.search.recall.scene.models.req.UserRecallRequest;
|
...
|
...
|
@@ -28,6 +28,8 @@ public class QueryUserPersionalFactorBean { |
|
|
private UserPersionalFactorComponent userComponent;
|
|
|
@Autowired
|
|
|
private SortBrandVectorComponent sortBrandVectorComponent;
|
|
|
@Autowired
|
|
|
private RecallCommonConfigService recallCommonConfigService;
|
|
|
|
|
|
/**
|
|
|
* 获取个性化因子
|
...
|
...
|
@@ -54,7 +56,6 @@ public class QueryUserPersionalFactorBean { |
|
|
begin = System.currentTimeMillis();
|
|
|
UserPersonalFactorRspNew userFactor = userComponent.queryUserPersionalFactor(userRecallRequest.getUid(), userRecallRequest.getUdid(), pageFactor.getMisortIds());
|
|
|
cost = System.currentTimeMillis() - begin;
|
|
|
|
|
|
if (userRecallRequest.openDetailLog()) {
|
|
|
StringBuilder sizeLogInfo = new StringBuilder();
|
|
|
sizeLogInfo.append("SKN_SIZE is ").append(userFactor.getRecommendSknList().size()).append(";");
|
...
|
...
|
@@ -66,10 +67,9 @@ public class QueryUserPersionalFactorBean { |
|
|
} else {
|
|
|
RECALL_NEW_LOGGER.info("QueryUserPersionalFactorBean[2]:queryUserPersionalFactor. uid is[{}],udid is[{}], cost is[{}]", uid, udid, cost);
|
|
|
}
|
|
|
|
|
|
//3、构造结果
|
|
|
begin = System.currentTimeMillis();
|
|
|
UserPersonalFactor userPersonalFactor = this.buildUserPersonalFactor(pageFactor, userFactor);
|
|
|
UserPersonalFactor userPersonalFactor = this.buildUserPersonalFactor(userRecallRequest.getPageId(), pageFactor, userFactor);
|
|
|
cost = System.currentTimeMillis() - begin;
|
|
|
RECALL_NEW_LOGGER.info("QueryUserPersionalFactorBean[3]:buildUserPersonalFactor, uid is[{}],udid is[{}], cost is[{}ms],", uid, udid, cost);
|
|
|
return userPersonalFactor;
|
...
|
...
|
@@ -79,7 +79,7 @@ public class QueryUserPersionalFactorBean { |
|
|
}
|
|
|
}
|
|
|
|
|
|
private UserPersonalFactor buildUserPersonalFactor(PagePersonalFactor pageFactor, UserPersonalFactorRspNew userFactor) {
|
|
|
private UserPersonalFactor buildUserPersonalFactor(int pageId, PagePersonalFactor pageFactor, UserPersonalFactorRspNew userFactor) {
|
|
|
//1、构造品类价格带
|
|
|
List<SortPriceAreas> sortPriceAreasList = this.getSortPriceAreasListWithSort(userFactor, pageFactor);
|
|
|
//2、构造推荐的skn列表
|
...
|
...
|
@@ -93,21 +93,20 @@ public class QueryUserPersionalFactorBean { |
|
|
pageSortBrandKeys.add(pageSortBrand.key());
|
|
|
}
|
|
|
//4、构造实时【品类+品牌】
|
|
|
int maxRealTimeSortBrandCount = RecallCommonConstants.maxRealTimeSortBrandCount;
|
|
|
List<SortBrand> realTimeSortBrandList = this.getSortBrandListWithSort(pageSortBrandKeys, filterSortBrandKeys, userFactor.getRealTimeSortBrandList(), maxRealTimeSortBrandCount);
|
|
|
int recSortBrandCount = recallCommonConfigService.getRecSortBrandCount(pageId);
|
|
|
List<SortBrand> realTimeSortBrandList = this.getSortBrandListWithSort(pageSortBrandKeys, filterSortBrandKeys, userFactor.getRealTimeSortBrandList(), recSortBrandCount);
|
|
|
for (SortBrand existSortBrand : realTimeSortBrandList) {
|
|
|
filterSortBrandKeys.add(existSortBrand.key());
|
|
|
}
|
|
|
//5、构造基于RNN向量的【品牌+品牌】,去除实时的品类和品牌
|
|
|
List<SortBrand> vectorRnnSortBrandList = new ArrayList<>();
|
|
|
// int maxVectorRNNSortBrandCount = RecallCommonConstants.maxVectorRNNSortBrandCount;
|
|
|
// List<SortBrand> vectorRnnSortBrandList = sortBrandVectorComponent.queryVectorSortBrandList(pageFactor, filterSortBrandKeys, userFactor.getBrandVector(), userFactor.getSortBrandVector(),true, maxVectorRNNSortBrandCount);
|
|
|
// for (SortBrand existSortBrand : vectorRnnSortBrandList) {
|
|
|
// filterSortBrandKeys.add(existSortBrand.key());
|
|
|
// }
|
|
|
int vectorRNNSortBrandCount = recallCommonConfigService.getVectorRNNSortBrandCount(pageId);
|
|
|
List<SortBrand> vectorRnnSortBrandList = sortBrandVectorComponent.queryVectorSortBrandList(pageFactor, filterSortBrandKeys, userFactor.getBrandVector(), userFactor.getSortBrandVector(), true, vectorRNNSortBrandCount);
|
|
|
for (SortBrand existSortBrand : vectorRnnSortBrandList) {
|
|
|
filterSortBrandKeys.add(existSortBrand.key());
|
|
|
}
|
|
|
//6、构造基于W2V向量的【品牌+品牌】,去除实时的品类和品牌
|
|
|
int maxVectorW2SortBrandCount = RecallCommonConstants.maxVectorW2SortBrandCount;
|
|
|
List<SortBrand> vectorW2vSortBrandList = sortBrandVectorComponent.queryVectorSortBrandList(pageFactor, filterSortBrandKeys, userFactor.getBrandVectorW2v(), userFactor.getSortBrandVectorW2v(), false, maxVectorW2SortBrandCount);
|
|
|
int vecW2vSortBrandCount = recallCommonConfigService.getVectorW2vSortBrandCount(pageId);
|
|
|
List<SortBrand> vectorW2vSortBrandList = sortBrandVectorComponent.queryVectorSortBrandList(pageFactor, filterSortBrandKeys, userFactor.getBrandVectorW2v(), userFactor.getSortBrandVectorW2v(), false, vecW2vSortBrandCount);
|
|
|
for (SortBrand existSortBrand : vectorW2vSortBrandList) {
|
|
|
filterSortBrandKeys.add(existSortBrand.key());
|
|
|
}
|
...
|
...
|
|