Authored by hugufei

品类页添加uid尾数配置【uid尾数为5的】

... ... @@ -182,12 +182,25 @@ public class SearchDynamicConfigService {
}
/**
* 品类页召回时使用的uid[尾数]
*/
public boolean isGoToSortRecallUser(int uid) {
String uidMantissas = configReader.getString("search.sortpage.recall.uid.mantissa", "5");
if(uidMantissas.contains(String.valueOf(uid % 10))){
return true;
}
return false;
}
/**
* 召回时是否使用全局品牌id
*/
public boolean isSortPageRecallUseGlobalBrand() {
return configReader.getBoolean("search.sortpage.recall.use_global_brand", false);
}
/**
* 个性化降级配置
*/
... ...
... ... @@ -90,7 +90,7 @@ public class SortSceneService extends AbstractSceneService {
this.addParamsToParamMap(paramMap);
CompletableFuture<SearchApiResult> productListFuture = null;
// 2、获取商品列表-是否使用召回策略
if (searchDynamicConfigService.isSortPageRecallOpen() && searchCommonHelper.isOrderEmpty(paramMap) && searchCommonHelper.hasUid(paramMap)) {
if (goToRecall(paramMap)) {
productListFuture = CompletableFuture.supplyAsync(() -> sortRecallSceneService.productList(this.newParamMap(paramMap)), executorService);
} else {
productListFuture = CompletableFuture.supplyAsync(() -> sceneProductListService.productList(this.newParamMap(paramMap)), executorService);
... ... @@ -117,6 +117,23 @@ public class SortSceneService extends AbstractSceneService {
}
}
private boolean goToRecall(Map<String, String> paramMap) {
if (!searchDynamicConfigService.isSortPageRecallOpen()) {
return false;
}
if (!searchCommonHelper.isOrderEmpty(paramMap) && searchCommonHelper.hasUid(paramMap)) {
return false;
}
int uid = searchCommonHelper.getUid(paramMap);
if (uid <= 0) {
return false;
}
if (!searchDynamicConfigService.isGoToSortRecallUser(uid)) {
return false;
}
return true;
}
@Override
public SearchApiResult aggregations(Map<String, String> paramMap) {
try {
... ...
... ... @@ -38,6 +38,7 @@ search.suggestion.tips.conversion.open=true
#recall
search.sortpage.recall.open=true
search.sortpage.recall.use_global_brand=false
search.sortpage.recall.uid.mantissa=5
#rateLimit
search.persional.rateLimit.brand.productList=100:2
... ...