|
|
package com.yoho.search.service.recall.beans.persional;
|
|
|
|
|
|
import com.yoho.search.common.utils.ABUserPartitionUtils;
|
|
|
import com.yoho.search.core.personalized.models.SortBrand;
|
|
|
import com.yoho.search.core.personalized.models.SortPriceAreas;
|
|
|
import com.yoho.search.core.personalized.models.UserPersonalFactorRsp;
|
...
|
...
|
@@ -86,11 +85,13 @@ public class QueryUserPersionalFactorBean { |
|
|
for (SortBrand pageSortBrand : pageFactor.getSortBrandList()) {
|
|
|
pageSortBrandKeys.add(pageSortBrand.key());
|
|
|
}
|
|
|
//4、构造临时过滤对象
|
|
|
Set<String> filterSortBrandKeys = new HashSet<>();
|
|
|
//5、构造实时【品类+品牌】
|
|
|
|
|
|
//4、构造实时【品类+品牌】
|
|
|
int recSortBrandCount = recallConfigService.querySortBrandConfigCount(pageId, SortBrandType.REC_SORT_BRAND, 12);
|
|
|
List<SortBrand> realTimeSortBrandList = this.queryRealTimeSortBrandList(pageSortBrandKeys, filterSortBrandKeys, userFactor.getRealTimeSortBrandList(), recSortBrandCount);
|
|
|
List<SortBrand> realTimeSortBrandList = this.joinRealTimeSortBrandList(pageSortBrandKeys, userFactor.getRealTimeSortBrandList(), recSortBrandCount);
|
|
|
|
|
|
//5、构造临时过滤对象
|
|
|
Set<String> filterSortBrandKeys = new HashSet<>();
|
|
|
for (SortBrand existSortBrand : realTimeSortBrandList) {
|
|
|
filterSortBrandKeys.add(existSortBrand.key());
|
|
|
}
|
...
|
...
|
@@ -107,7 +108,7 @@ public class QueryUserPersionalFactorBean { |
|
|
filterSortBrandKeys.add(existSortBrand.key());
|
|
|
}
|
|
|
//8、构造个性化结果[如果个性化结果为空,则取配置的品类品牌数据]
|
|
|
UserPersonalFactor userPersonalFactor = new UserPersonalFactor(recommendSknList, realTimeSimilarSknList,realTimeYoutubeSknList, sortPriceAreasList, realTimeSortBrandList, vectorRnnSortBrandList, vectorW2vSortBrandList);
|
|
|
UserPersonalFactor userPersonalFactor = new UserPersonalFactor(recommendSknList, realTimeSimilarSknList, realTimeYoutubeSknList, sortPriceAreasList, realTimeSortBrandList, vectorRnnSortBrandList, vectorW2vSortBrandList);
|
|
|
if (userPersonalFactor.isUserPersonalFactorEmpty()) {
|
|
|
this.fillConfigSortBrandList(userPersonalFactor, pageId, pageFactor, pageSortBrandKeys, filterSortBrandKeys);
|
|
|
}
|
...
|
...
|
@@ -121,18 +122,15 @@ public class QueryUserPersionalFactorBean { |
|
|
userPersonalFactor.setConfigSortBrandList(configSortBrandList);
|
|
|
}
|
|
|
|
|
|
private List<SortBrand> queryRealTimeSortBrandList(Set<String> pageSortBrandKeys, Set<String> filterSortBrandKeys, List<SortBrand> userSortBrands, int maxCount) {
|
|
|
private List<SortBrand> joinRealTimeSortBrandList(Set<String> pageSortBrandKeys, List<SortBrand> userSortBrands, int maxCount) {
|
|
|
List<SortBrand> results = new ArrayList<>();
|
|
|
if (pageSortBrandKeys == null || pageSortBrandKeys.isEmpty() || userSortBrands == null || userSortBrands.isEmpty()) {
|
|
|
if (pageSortBrandKeys == null || pageSortBrandKeys.isEmpty() || userSortBrands == null || userSortBrands.isEmpty() || maxCount <= 0) {
|
|
|
return results;
|
|
|
}
|
|
|
for (SortBrand sortBrand : userSortBrands) {
|
|
|
if (!pageSortBrandKeys.contains(sortBrand.key())) {
|
|
|
continue;
|
|
|
}
|
|
|
if (filterSortBrandKeys != null && filterSortBrandKeys.contains(sortBrand.key())) {
|
|
|
continue;
|
|
|
}
|
|
|
results.add(sortBrand);
|
|
|
if (results.size() >= maxCount) {
|
|
|
break;
|
...
|
...
|
|