Authored by hugufei

分页参数不影响召回

... ... @@ -67,7 +67,7 @@ public class RecallService {
//1、构造召回请求
List<RecallRequest> allRequests = new ArrayList<>();
//2、构造非个性化的请求
List<RecallRequest> commonRequests = commonRequestBuilder.buildCommonRecallRequests(param.getParamQueryFilter(), param.getFirstProductSkns(), param.getPageSize());
List<RecallRequest> commonRequests = commonRequestBuilder.buildCommonRecallRequests(param.getParamQueryFilter(), param.getFirstProductSkns());
allRequests.addAll(commonRequests);
//4、构建个性化品牌的召回请求
List<RecallRequest> brandRequests = brandRequestBuilder.buildBrandRecallRequests(param.getParamQueryFilter(), persionalFactor.getBrandIds());
... ...
... ... @@ -49,8 +49,8 @@ public class SceneRecallService {
public SearchApiResult sceneRecall(Map<String, String> paramMap) {
try {
//1、分页参数验证
int page = MapUtils.getIntValue(paramMap, "page", 10);
int pageSize = MapUtils.getIntValue(paramMap, "viewNum", 10);
int page = MapUtils.getIntValue(paramMap, "page", 1);
int pageSize = MapUtils.getIntValue(paramMap, "viewNum", 20);
if (page < 1 || pageSize < 0 || page * pageSize > 1000000) {
return new SearchApiResult().setCode(400).setMessage("分页参数不合法");
}
... ... @@ -74,7 +74,6 @@ public class SceneRecallService {
}
}
private List<Map<String, Object>> queryProductList(RecallSknParams recallSknParams, RecallSknResult recallSknResult,int page,int pageSize) {
//1、判断当前页码是否在召回的页码里
int recallTotalPage = recallSknResult.getRecallTotalPage();
... ...
... ... @@ -18,10 +18,9 @@ public class CommonRecallRequestBuilder{
*
* @param paramQueryFilter
* @param firstProductSkns
* @param pageSize
* @return
*/
public List<RecallRequest> buildCommonRecallRequests(ParamQueryFilter paramQueryFilter, List<String> firstProductSkns, int pageSize) {
public List<RecallRequest> buildCommonRecallRequests(ParamQueryFilter paramQueryFilter, List<String> firstProductSkns) {
//1、构造召回请求
List<RecallRequest> requests = new ArrayList<>();
//1.1) firstSkn的召回
... ... @@ -29,7 +28,7 @@ public class CommonRecallRequestBuilder{
//1.2) 直通车的召回
requests.add(this.buildDirectTrainRequest(paramQueryFilter, SknCountConstants.DIRECT_TRAIN));
//1.3) 人气的召回
requests.add(this.buildCommonRequest(paramQueryFilter, Math.min(3 * pageSize, SknCountConstants.COMMON_HEAT_VALUE)));
requests.add(this.buildCommonRequest(paramQueryFilter,SknCountConstants.COMMON));
//1.4) 新开店铺的召回
requests.add(this.buildNewShopRequest(paramQueryFilter, SknCountConstants.NEW_SHOP));
//1.5) 流量补偿的召回
... ...
... ... @@ -21,19 +21,16 @@ public class RecallParamsBuilder {
@Autowired
private RecallServiceHelper recallServiceHelper;
public RecallSknParams buildRecallParams(Map<String, String> paramMap) throws Exception {
public RecallSknParams buildRecallParams(Map<String, String> paramMap,int pageSize) throws Exception {
//1、获取链接中的query和filter参数
QueryBuilder query = searchServiceHelepr.constructQueryBuilder(paramMap);
BoolQueryBuilder filter = searchServiceHelepr.constructFilterBuilder(paramMap, null);
ParamQueryFilter queryFilter = new ParamQueryFilter(query,filter);
//2、获取分页参数
int pageSize = MapUtils.getIntValue(paramMap, "viewNum", 10);
//3、获取firstSkn参数
//2、获取firstSkn参数
List<String> firstProductSkns = recallServiceHelper.getFirstProductSkns(paramMap);
//4、获取uid或udid
//3、获取uid或udid
int uid = MapUtils.getIntValue(paramMap, "uid", 1);
String udid = MapUtils.getString(paramMap, "udid", "");
... ...
... ... @@ -5,7 +5,7 @@ public class SknCountConstants {
/**
* 单次召回的商品数量
*/
public static final int COMMON_HEAT_VALUE = 60;
public static final int COMMON = 60;
public static final int FIRST_SKN = 1;
public static final int DIRECT_TRAIN = 20;
... ...