Authored by hugufei

拆包

Showing 13 changed files with 38 additions and 37 deletions
... ... @@ -9,7 +9,7 @@ import com.yoho.search.common.utils.SearchKeyWordUtils;
import com.yoho.search.core.es.model.SearchParam;
import com.yoho.search.core.es.model.SearchResult;
import com.yoho.search.models.SearchApiResult;
import com.yoho.search.service.recall.beans.UserRecallRequestBuilder;
import com.yoho.search.service.recall.beans.requests.UserRecallRequestBuilder;
import com.yoho.search.service.base.SknReturnInfoBaseService;
import com.yoho.search.service.recall.UserRecallRequestResponseService;
import com.yoho.search.service.recall.strategy.StrategyEnum;
... ...
package com.yoho.search.service.recall;
import com.yoho.search.service.base.BatchRecallBaseService;
import com.yoho.search.service.recall.beans.CommonRecallRequestBuilder;
import com.yoho.search.service.recall.beans.SortBrandRecallRequestBuilder;
import com.yoho.search.service.recall.beans.SknRecallRecallRequestResponseBuilder;
import com.yoho.search.service.recall.beans.requests.CommonRecallRequestBuilder;
import com.yoho.search.service.recall.beans.requests.SortBrandRecallRequestBuilder;
import com.yoho.search.service.recall.beans.requests.SknRecallRecallRequestResponseBuilder;
import com.yoho.search.models.recall.PagePersonalFactor;
import com.yoho.search.models.recall.UserPersonalFactor;
import com.yoho.search.models.recall.RecallRequest;
... ... @@ -31,9 +31,9 @@ class BatchRequestResponseEntrace {
@Autowired
private SortBrandRecallRequestBuilder sortBrandRecallRequestBuilder;
@Autowired
private BatchRecallBaseService batchRecallBaseService;
@Autowired
private SknRecallRecallRequestResponseBuilder sknRecallRecallRequestResponseBuilder;
@Autowired
private BatchRecallBaseService batchRecallBaseService;
private ExecutorService recallExecutorService = Executors.newFixedThreadPool(50);
... ...
... ... @@ -9,8 +9,8 @@ import com.yoho.search.core.es.model.SearchParam;
import com.yoho.search.core.es.model.SearchResult;
import com.yoho.search.models.SearchApiResult;
import com.yoho.search.service.helper.GoodsCoverHelper;
import com.yoho.search.service.recall.beans.UserRecallRequestBuilder;
import com.yoho.search.service.base.SknReturnInfoBaseService;
import com.yoho.search.service.recall.beans.requests.UserRecallRequestBuilder;
import com.yoho.search.service.recall.helper.SortBuilderHelper;
import com.yoho.search.service.recall.strategy.StrategyEnum;
import com.yoho.search.models.recall.UserRecallRequest;
... ...
... ... @@ -2,10 +2,9 @@ package com.yoho.search.service.recall;
import com.yoho.search.cache.beans.AbstractCacheBean;
import com.yoho.search.models.recall.*;
import com.yoho.search.service.recall.beans.QueryUserPersionalFactorBean;
import com.yoho.search.service.recall.beans.RecallMergerResultBuilder;
import com.yoho.search.service.recall.beans.UserRecallResponseResultBuilder;
import com.yoho.search.service.base.QueryPageFactorBaseService;
import com.yoho.search.service.recall.beans.QueryUserPersionalFactorBean;
import com.yoho.search.service.recall.beans.result.UserRecallResponseResultBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -25,8 +24,6 @@ public class UserRecallRequestResponseService extends AbstractCacheBean<UserReca
@Autowired
private QueryUserPersionalFactorBean queryUserPersionalFactorBean;
@Autowired
private RecallMergerResultBuilder recallMergerResultBuilder;
@Autowired
private UserRecallResponseResultBuilder userRecallResponseResultBuilder;
@Autowired
private BatchRequestResponseEntrace batchRequestResponseEntrace;
... ... @@ -81,15 +78,14 @@ public class UserRecallRequestResponseService extends AbstractCacheBean<UserReca
RECALL_NEW_LOGGER.info("doRealRecall[2]-queryUserFactor,cost is [{}]", System.currentTimeMillis() - begin);
//3、获取召回结果
begin = System.currentTimeMillis();
List<RecallRequestResponse> requestResponses = batchRequestResponseEntrace.batchRecall(userRecallRequest, pageFactor, userPersonalFactor);
RECALL_NEW_LOGGER.info("doRealRecall[3]-batchRecall,cost is [{}]", System.currentTimeMillis() - begin);
//4、获取skn列表[去重]
RecallMergerResult recallMergerResult = recallMergerResultBuilder.buildRecallMergerResult(requestResponses);
//5、构造真实结果[排序,截取skn]
//4、构造真实结果[排序,截取skn]
begin = System.currentTimeMillis();
UserRecallResponse userRecallResponse = userRecallResponseResultBuilder.buildUserRecallResponse(recallMergerResult, userRecallRequest, userPersonalFactor);
RECALL_NEW_LOGGER.info("UserRecallCacheBean[4]-builderRecallResult,cost is [{}]", System.currentTimeMillis() - begin);
UserRecallResponse userRecallResponse = userRecallResponseResultBuilder.buildUserRecallResponse(requestResponses, userRecallRequest, userPersonalFactor);
RECALL_NEW_LOGGER.info("doRealRecall[4]-buildUserRecallResponse,cost is [{}]", System.currentTimeMillis() - begin);
return userRecallResponse;
}
... ...
package com.yoho.search.service.recall.beans;
package com.yoho.search.service.recall.beans.requests;
import com.yoho.search.models.recall.PagePersonalFactor;
import com.yoho.search.models.recall.RecallRequest;
import com.yoho.search.models.recall.UserRecallRequest;
import com.yoho.search.service.recall.beans.RecallConfigService;
import com.yoho.search.service.recall.strategy.IStrategy;
import com.yoho.search.service.recall.strategy.StrategyEnum;
import com.yoho.search.service.recall.strategy.impls.*;
... ...
package com.yoho.search.service.recall.beans;
package com.yoho.search.service.recall.beans.requests;
import com.yoho.search.models.recall.PagePersonalFactor;
import com.yoho.search.models.recall.RecallRequest;
import com.yoho.search.models.recall.UserRecallRequest;
import com.yoho.search.service.recall.beans.RecallConfigService;
import com.yoho.search.service.recall.strategy.IStrategy;
import com.yoho.search.service.recall.strategy.StrategyEnum;
import com.yoho.search.service.recall.strategy.impls.DirectTrainBrandStrategy;
... ...
package com.yoho.search.service.recall.beans;
package com.yoho.search.service.recall.beans.requests;
import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder;
import com.yoho.search.base.beans.ZkConfigManager;
... ... @@ -13,6 +13,7 @@ import com.yoho.search.core.es.model.SearchParam;
import com.yoho.search.core.es.model.SearchResult;
import com.yoho.search.service.base.PageSknCodeBitSetBaseService;
import com.yoho.search.service.base.ProductSknCodeBaseService;
import com.yoho.search.service.recall.beans.RecallConfigService;
import com.yoho.search.service.recall.helper.StrategyHelper;
import com.yoho.search.service.recall.strategy.StrategyEnum;
import com.yoho.search.service.recall.strategy.impls.IRecallSknStrategy;
... ...
package com.yoho.search.service.recall.beans;
package com.yoho.search.service.recall.beans.requests;
import com.yoho.search.core.personalized.models.SortBrand;
import com.yoho.search.service.recall.beans.RecallConfigService;
import com.yoho.search.service.recall.strategy.IStrategy;
import com.yoho.search.service.recall.strategy.SortBrandType;
import com.yoho.search.models.recall.SortBrandSknCount;
... ...
package com.yoho.search.service.recall.beans;
package com.yoho.search.service.recall.beans.requests;
import com.yoho.search.base.utils.ConvertUtils;
import com.yoho.search.common.SearchRequestParams;
... ...
package com.yoho.search.service.recall.beans;
package com.yoho.search.service.recall.beans.result;
import com.yoho.search.service.recall.helper.StrategyHelper;
import com.yoho.search.models.recall.RecallMergerResult;
... ...
package com.yoho.search.service.recall.beans;
package com.yoho.search.service.recall.beans.result;
import com.yoho.search.base.utils.SearchCollectionUtils;
import com.yoho.search.base.utils.Transfer;
import com.yoho.search.core.personalized.models.PersonalizedSearch;
import com.yoho.search.core.personalized.models.SortPriceAreas;
import com.yoho.search.models.recall.*;
import com.yoho.search.service.base.SknBaseInfoBaseService;
import com.yoho.search.service.helper.ProductListSortHelper;
import com.yoho.search.service.helper.ProductListSortKey;
import com.yoho.search.service.recall.beans.RecallConfigService;
import com.yoho.search.service.recall.helper.RecallConfigConstants;
import com.yoho.search.service.recall.helper.StrategyHelper;
import com.yoho.search.service.recall.helper.W2vFeatureCalculator;
import com.yoho.search.models.recall.RecallMergerResult;
import com.yoho.search.models.recall.RecallSknInfo;
import com.yoho.search.models.recall.UserFeatureFactor;
import com.yoho.search.models.recall.UserPersonalFactor;
import com.yoho.search.models.recall.SknBaseInfoResponse;
import com.yoho.search.models.recall.UserRecallRequest;
import com.yoho.search.models.recall.UserRecallResponse;
import com.yoho.search.service.recall.strategy.StrategyEnum;
import com.yoho.search.service.scorer.personal.PersonalVectorFeatureSearch;
import org.slf4j.Logger;
... ... @@ -33,6 +28,8 @@ public class UserRecallResponseResultBuilder {
private static final Logger RECALL_NEW_LOGGER = LoggerFactory.getLogger("RECALL");
@Autowired
private RecallMergerResultBuilder recallMergerResultBuilder;
@Autowired
private PersonalVectorFeatureSearch personalVectorFeatureSearch;
@Autowired
private SknBaseInfoBaseService sknBaseInfoBaseService;
... ... @@ -43,12 +40,16 @@ public class UserRecallResponseResultBuilder {
/**
* 构造真实的UserRecallResponse
* @param recallMergerResult
*
* @param requestResponses
* @param userRecallRequest
* @param userPersonalFactor
* @return
*/
public UserRecallResponse buildUserRecallResponse(RecallMergerResult recallMergerResult, UserRecallRequest userRecallRequest, UserPersonalFactor userPersonalFactor) {
public UserRecallResponse buildUserRecallResponse(List<RecallRequestResponse> requestResponses, UserRecallRequest userRecallRequest, UserPersonalFactor userPersonalFactor) {
//0、去重加处理策略
RecallMergerResult recallMergerResult = recallMergerResultBuilder.buildRecallMergerResult(requestResponses);
//1、获取总数
final long total = recallMergerResult.getTotal();
... ... @@ -80,7 +81,7 @@ public class UserRecallResponseResultBuilder {
}
sknResultList = SearchCollectionUtils.safeSubList(sknResultList, 0, recallTotalPage * pageSize);//为用户最多保留X个skn进缓存
RECALL_NEW_LOGGER.info("total recall skn count after merger2 is [{}],recallTotalPage is[{}] ", sknResultList.size(),recallTotalPage);
RECALL_NEW_LOGGER.info("total recall skn count after merger2 is [{}],recallTotalPage is[{}] ", sknResultList.size(), recallTotalPage);
//9、添加日志
if (userRecallRequest.openDetailLog()) {
... ...
... ... @@ -9,7 +9,7 @@ import com.yoho.search.service.base.QueryPageFactorBaseService;
import com.yoho.search.service.index.BrandIndexBaseService;
import com.yoho.search.service.index.ProductSortIndexBaseService;
import com.yoho.search.service.recall.beans.QueryUserPersionalFactorBean;
import com.yoho.search.service.recall.beans.UserRecallRequestBuilder;
import com.yoho.search.service.recall.beans.requests.UserRecallRequestBuilder;
import com.yoho.search.models.recall.PagePersonalFactor;
import com.yoho.search.models.recall.UserPersonalFactor;
import com.yoho.search.models.recall.UserRecallRequest;
... ...
... ... @@ -16,7 +16,7 @@ import com.yoho.search.service.helper.SearchParamHelper;
import com.yoho.search.service.helper.SearchSortHelper;
import com.yoho.search.service.index.ProductIndexBaseService;
import com.yoho.search.service.recall.SceneRecallProductListService;
import com.yoho.search.service.recall.beans.UserRecallRequestBuilder;
import com.yoho.search.service.recall.beans.requests.UserRecallRequestBuilder;
import com.yoho.search.service.recall.strategy.NotRecallTypeEnum;
import com.yoho.search.models.recall.UserRecallRequest;
import org.apache.commons.lang.StringUtils;
... ...