Authored by hugufei

fix bug

1 package com.yoho.search.service.recall.beans.persional; 1 package com.yoho.search.service.recall.beans.persional;
2 2
3 -import com.yoho.search.common.utils.ABUserPartitionUtils;  
4 import com.yoho.search.core.personalized.models.SortBrand; 3 import com.yoho.search.core.personalized.models.SortBrand;
5 import com.yoho.search.core.personalized.models.SortPriceAreas; 4 import com.yoho.search.core.personalized.models.SortPriceAreas;
6 import com.yoho.search.core.personalized.models.UserPersonalFactorRsp; 5 import com.yoho.search.core.personalized.models.UserPersonalFactorRsp;
@@ -86,11 +85,13 @@ public class QueryUserPersionalFactorBean { @@ -86,11 +85,13 @@ public class QueryUserPersionalFactorBean {
86 for (SortBrand pageSortBrand : pageFactor.getSortBrandList()) { 85 for (SortBrand pageSortBrand : pageFactor.getSortBrandList()) {
87 pageSortBrandKeys.add(pageSortBrand.key()); 86 pageSortBrandKeys.add(pageSortBrand.key());
88 } 87 }
89 - //4、构造临时过滤对象  
90 - Set<String> filterSortBrandKeys = new HashSet<>();  
91 - //5、构造实时【品类+品牌】 88 +
  89 + //4、构造实时【品类+品牌】
92 int recSortBrandCount = recallConfigService.querySortBrandConfigCount(pageId, SortBrandType.REC_SORT_BRAND, 12); 90 int recSortBrandCount = recallConfigService.querySortBrandConfigCount(pageId, SortBrandType.REC_SORT_BRAND, 12);
93 - List<SortBrand> realTimeSortBrandList = this.queryRealTimeSortBrandList(pageSortBrandKeys, filterSortBrandKeys, userFactor.getRealTimeSortBrandList(), recSortBrandCount); 91 + List<SortBrand> realTimeSortBrandList = this.joinRealTimeSortBrandList(pageSortBrandKeys, userFactor.getRealTimeSortBrandList(), recSortBrandCount);
  92 +
  93 + //5、构造临时过滤对象
  94 + Set<String> filterSortBrandKeys = new HashSet<>();
94 for (SortBrand existSortBrand : realTimeSortBrandList) { 95 for (SortBrand existSortBrand : realTimeSortBrandList) {
95 filterSortBrandKeys.add(existSortBrand.key()); 96 filterSortBrandKeys.add(existSortBrand.key());
96 } 97 }
@@ -107,7 +108,7 @@ public class QueryUserPersionalFactorBean { @@ -107,7 +108,7 @@ public class QueryUserPersionalFactorBean {
107 filterSortBrandKeys.add(existSortBrand.key()); 108 filterSortBrandKeys.add(existSortBrand.key());
108 } 109 }
109 //8、构造个性化结果[如果个性化结果为空,则取配置的品类品牌数据] 110 //8、构造个性化结果[如果个性化结果为空,则取配置的品类品牌数据]
110 - UserPersonalFactor userPersonalFactor = new UserPersonalFactor(recommendSknList, realTimeSimilarSknList,realTimeYoutubeSknList, sortPriceAreasList, realTimeSortBrandList, vectorRnnSortBrandList, vectorW2vSortBrandList); 111 + UserPersonalFactor userPersonalFactor = new UserPersonalFactor(recommendSknList, realTimeSimilarSknList, realTimeYoutubeSknList, sortPriceAreasList, realTimeSortBrandList, vectorRnnSortBrandList, vectorW2vSortBrandList);
111 if (userPersonalFactor.isUserPersonalFactorEmpty()) { 112 if (userPersonalFactor.isUserPersonalFactorEmpty()) {
112 this.fillConfigSortBrandList(userPersonalFactor, pageId, pageFactor, pageSortBrandKeys, filterSortBrandKeys); 113 this.fillConfigSortBrandList(userPersonalFactor, pageId, pageFactor, pageSortBrandKeys, filterSortBrandKeys);
113 } 114 }
@@ -121,18 +122,15 @@ public class QueryUserPersionalFactorBean { @@ -121,18 +122,15 @@ public class QueryUserPersionalFactorBean {
121 userPersonalFactor.setConfigSortBrandList(configSortBrandList); 122 userPersonalFactor.setConfigSortBrandList(configSortBrandList);
122 } 123 }
123 124
124 - private List<SortBrand> queryRealTimeSortBrandList(Set<String> pageSortBrandKeys, Set<String> filterSortBrandKeys, List<SortBrand> userSortBrands, int maxCount) { 125 + private List<SortBrand> joinRealTimeSortBrandList(Set<String> pageSortBrandKeys, List<SortBrand> userSortBrands, int maxCount) {
125 List<SortBrand> results = new ArrayList<>(); 126 List<SortBrand> results = new ArrayList<>();
126 - if (pageSortBrandKeys == null || pageSortBrandKeys.isEmpty() || userSortBrands == null || userSortBrands.isEmpty()) { 127 + if (pageSortBrandKeys == null || pageSortBrandKeys.isEmpty() || userSortBrands == null || userSortBrands.isEmpty() || maxCount <= 0) {
127 return results; 128 return results;
128 } 129 }
129 for (SortBrand sortBrand : userSortBrands) { 130 for (SortBrand sortBrand : userSortBrands) {
130 if (!pageSortBrandKeys.contains(sortBrand.key())) { 131 if (!pageSortBrandKeys.contains(sortBrand.key())) {
131 continue; 132 continue;
132 } 133 }
133 - if (filterSortBrandKeys != null && filterSortBrandKeys.contains(sortBrand.key())) {  
134 - continue;  
135 - }  
136 results.add(sortBrand); 134 results.add(sortBrand);
137 if (results.size() >= maxCount) { 135 if (results.size() >= maxCount) {
138 break; 136 break;