Authored by hugufei

默认不使用新的召回机制

... ... @@ -22,7 +22,7 @@ import com.yoho.search.base.monitor.PerformanceMonitor;
*/
public class ControllerCostInterceptor implements HandlerInterceptor {
private static final Logger CONTROLLER_COST = LoggerFactory.getLogger("CONTROLLER_COST");
static final Logger CONTROLLER_COST = LoggerFactory.getLogger("CONTROLLER_COST");
private static final Logger CONTROLLER_PERFORMANCE = LoggerFactory.getLogger("CONTROLLER_PERFORMANCE");
... ... @@ -66,10 +66,8 @@ public class ControllerCostInterceptor implements HandlerInterceptor {
if (cost <= 500) {
return;
}
// // 5、打印响应超过500ms的请求与参数
// CONTROLLER_COST.info("run more than 500ms ,cost [{}] ms, RequestURL: {}", cost, HttpServletRequestUtils.getRequestUrl(request));
// // 5、打印响应超过500ms的请求与参数
// CONTROLLER_COST.info("run more than 500ms ,cost [{}] ms, RequestURL: {}", cost, HttpServletRequestUtils.getRequestUrl(request));
} catch (Exception e) {
// TODO: handle exception
} finally {
... ...
... ... @@ -233,7 +233,7 @@ public class SearchDynamicConfigService {
return new PersionalRateLimitConfig(200, 10);
}
}
/**
* 召回策略配置
*/
... ... @@ -249,5 +249,13 @@ public class SearchDynamicConfigService {
return new ArrayList<PageRecallStrategyBO>();
}
}
/**
* 使用性能高的召回场景
*
* @return
*/
public boolean searchPersionalNewStrategyOpen() {
return configReader.getBoolean("search.persional.newstrategy.open", false);
}
}
... ...
... ... @@ -2,8 +2,6 @@ package com.yoho.search.service.scene;
import java.util.Map;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -12,7 +10,6 @@ import org.springframework.stereotype.Service;
import com.yoho.search.base.utils.SearchPageIdDefine;
import com.yoho.search.common.utils.SearchApiResultUtils;
import com.yoho.search.models.SearchApiResult;
import com.yoho.search.service.recall.CommonSceneProductListService;
import com.yoho.search.service.scene.common.AbstractSceneService;
import com.yoho.search.service.scene.common.SceneProductListService;
import com.yoho.search.service.scene.common.SceneSelectionsService;
... ... @@ -26,8 +23,6 @@ public class CommonSceneService extends AbstractSceneService {
private SceneProductListService sceneProductListService;
@Autowired
private SceneSelectionsService sceneSelectionsService;
@Autowired
private CommonSceneProductListService commonSceneProductListService;
@Override
public String pageId() {
... ... @@ -45,20 +40,13 @@ public class CommonSceneService extends AbstractSceneService {
// 1、添加默认参数
this.addParamsToParamMap(paramMap);
// 2、返回商品列表
int uid = MapUtils.getIntValue(paramMap, "uid", 0);
String order = MapUtils.getString(paramMap, "order", "");
if (uid > 0 && StringUtils.isEmpty(order)) {
return commonSceneProductListService.productListForPersional(paramMap);
} else {
return commonSceneProductListService.productListForDefault(paramMap);
}
// return sceneProductListService.productList(paramMap);
return sceneProductListService.productList(paramMap);
} catch (Exception e) {
logger.error("[func=CommonProductList][params=" + paramMap + "]", e);
return SearchApiResultUtils.errorSearchApiResult("CommonSceneService", paramMap, e);
}
}
@Override
public SearchApiResult aggregations(Map<String, String> paramMap) {
try {
... ...
... ... @@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -19,9 +20,11 @@ import com.yoho.search.core.es.model.SearchResult;
import com.yoho.search.models.SearchApiResult;
import com.yoho.search.service.base.ProductListSortService;
import com.yoho.search.service.base.SearchCommonService;
import com.yoho.search.service.base.SearchDynamicConfigService;
import com.yoho.search.service.base.index.ProductIndexBaseService;
import com.yoho.search.service.helper.SearchParamHelper;
import com.yoho.search.service.helper.SearchSortHelper;
import com.yoho.search.service.recall.CommonSceneProductListService;
@Service
public class SceneProductListService extends AbstractCacheAbleService {
... ... @@ -38,12 +41,46 @@ public class SceneProductListService extends AbstractCacheAbleService {
private SearchSortHelper searchSortHelper;
@Autowired
private ProductListSortService productListSortService;
@Autowired
private SearchDynamicConfigService searchDynamicConfigService;
@Autowired
private CommonSceneProductListService commonSceneProductListService;
@Override
public SearchCache getSearchCache() {
return searchCacheFactory.getSceneProductListSearchCache();
}
private boolean isPersionalScene(Map<String, String> paramMap) {
int uid = MapUtils.getIntValue(paramMap, "uid", 0);
String order = MapUtils.getString(paramMap, "order", "");
if (uid > 0 && StringUtils.isEmpty(order)) {
return true;
}
return false;
}
/**
* 场景化的商品列表接口
*
* @param paramMap
* @return
*/
public SearchApiResult productList(Map<String, String> paramMap) {
// 1、新个性化方案是否打开
boolean searchPersionalNewStrategyOpen = searchDynamicConfigService.searchPersionalNewStrategyOpen();
if (!searchPersionalNewStrategyOpen) {
return this.sceneProductListDefault(paramMap);
}
// 2、走新的个性化方案的场景
boolean isPersionalScene = this.isPersionalScene(paramMap);
if (isPersionalScene) {
return commonSceneProductListService.productListForPersional(paramMap);
} else {
return commonSceneProductListService.productListForDefault(paramMap);
}
}
/**
* 获取商品列表
*
... ... @@ -51,7 +88,7 @@ public class SceneProductListService extends AbstractCacheAbleService {
* @return
* @throws Exception
*/
public SearchApiResult productList(Map<String, String> paramMap) {
private SearchApiResult sceneProductListDefault(Map<String, String> paramMap) {
try {
// 1)构造搜索参数
SearchParam searchParam = this.buildProductListSearchParam(paramMap);
... ...
... ... @@ -43,6 +43,7 @@ search.sortpage.recall.uid.mantissa=0,1,2,3,4,5,6,7,8,9
#rateLimit
search.persional.rateLimit.open=true
search.persional.newstrategy.open=false
search.persional.rateLimit.brand.productList=200:2
search.persional.rateLimit.brand.aggregations=100:2
... ...