Authored by hugufei

品牌每种策略单独召回

... ... @@ -7,7 +7,7 @@ import com.yoho.search.base.utils.Transfer;
import com.yoho.search.common.cache.impls.SearchRedis;
import com.yoho.search.core.es.model.SearchParam;
import com.yoho.search.core.es.model.SearchResult;
import com.yoho.search.recall.scene.config.RecallConstants;
import com.yoho.search.recall.scene.constants.RecallConstants;
import com.yoho.search.recall.scene.helper.RecallResponseHelper;
import com.yoho.search.recall.scene.models.RecallRequest;
import com.yoho.search.recall.scene.models.RecallRequestResponse;
... ...
package com.yoho.search.recall.scene.constants;
public class RecallConstants {
/**
* 单次透传访问ES的最大次数
*/
public static final int MAX_ES_QUERY_PER_COUNT = 10;
/**
* 缓存时间
*/
public static final int CACHE_TIME_IN_SECOND_COMMON = 5 * 60;//5分钟缓存
public static final int CACHE_TIME_IN_SECOND_BRAND = 60 * 60;//60分钟缓存
public static final int CACHE_TIME_IN_SECOND_SORT_PRICE = 60 * 60;//60分钟缓存
/**
* 最多涉及的个性化因子数量
*/
public static final int MAX_FACTOR_COUNT_BRAND = 10;
public static final int MAX_FACTOR_COUNT_SORT = 5;
/**
* 单次召回的商品数量
*/
public static final int RECALL_SKN_COUNT_COMMON = 100;
public static final int RECALL_SKN_COUNT_FIRST_SKN = 1;
public static final int RECALL_SKN_COUNT_DIRECT_TRAIN = 5;
public static final int RECALL_SKN_COUNT_NEW_SHOP = 5;
public static final int RECALL_SKN_COUNT_PER_BRAND_NEW = 4;
public static final int RECALL_SKN_COUNT_PER_BRAND_HEATVALUE = 4;
public static final int RECALL_SKN_COUNT_PER_BRAND_PROMOTION = 4;
public static final int RECALL_SKN_COUNT_PER_BRAND_REDUCE_PRICE = 4;
public static final int RECALL_SKN_COUNT_PER_SORT_PRICE = 4;
}
... ...
package com.yoho.search.recall.scene.persional;
import com.yoho.search.recall.scene.config.RecallConstants;
import com.yoho.search.recall.scene.constants.RecallConstants;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilder;
import org.slf4j.Logger;
... ...
package com.yoho.search.recall.scene.request;
import com.yoho.search.recall.scene.config.RecallConstants;
import com.yoho.search.recall.scene.constants.RecallConstants;
import com.yoho.search.recall.scene.models.RecallRequest;
import com.yoho.search.recall.scene.strategy.StrategyNameEnum;
import com.yoho.search.recall.scene.strategy.impls.BrandHeatValueStrategy;
import com.yoho.search.recall.scene.strategy.impls.BrandNewShelveStrategy;
import com.yoho.search.recall.scene.strategy.impls.BrandPromotionStrategy;
import com.yoho.search.recall.scene.strategy.impls.BrandReducePriceStrategy;
import com.yoho.search.recall.sort.strategy.*;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilder;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@Component
... ... @@ -31,19 +28,19 @@ public class BrandRecallRequestBuilder extends BaseRecallRequest{
List<RecallRequest> requests = new ArrayList<>();
// 1) 人气
for (Integer brandId : brandIds) {
requests.add(this.buildBrandHeatValueRequest(query, filter, brandId, RecallConstants.RECALL_SKN_COUNT_PER_BRAND));
requests.add(this.buildBrandHeatValueRequest(query, filter, brandId, RecallConstants.RECALL_SKN_COUNT_PER_BRAND_HEATVALUE));
}
// 2) 新品
for (Integer brandId : brandIds) {
requests.add(this.buildBrandNewShelveRequest(query, filter, brandId, RecallConstants.RECALL_SKN_COUNT_PER_BRAND));
requests.add(this.buildBrandNewShelveRequest(query, filter, brandId, RecallConstants.RECALL_SKN_COUNT_PER_BRAND_NEW));
}
// 3) 新降价
for (Integer brandId : brandIds) {
requests.add(this.buildBrandNewReducePriceRequest(query, filter, brandId,RecallConstants.RECALL_SKN_COUNT_PER_BRAND));
requests.add(this.buildBrandNewReducePriceRequest(query, filter, brandId,RecallConstants.RECALL_SKN_COUNT_PER_BRAND_REDUCE_PRICE));
}
// 4) 新开促销
for (Integer brandId : brandIds) {
requests.add(this.buildBrandNewPromotionRequest(query, filter, brandId, RecallConstants.RECALL_SKN_COUNT_PER_BRAND));
requests.add(this.buildBrandNewPromotionRequest(query, filter, brandId, RecallConstants.RECALL_SKN_COUNT_PER_BRAND_PROMOTION));
}
return requests;
}
... ...
package com.yoho.search.recall.scene.request;
import com.yoho.search.recall.scene.config.RecallConstants;
import com.yoho.search.recall.scene.constants.RecallConstants;
import com.yoho.search.recall.scene.models.RecallRequest;
import com.yoho.search.recall.scene.strategy.StrategyNameEnum;
import com.yoho.search.recall.scene.strategy.impls.CommonDirectTrainStrategy;
import com.yoho.search.recall.scene.strategy.impls.CommonFirstSknStrategy;
import com.yoho.search.recall.scene.strategy.impls.CommonHeatValueStrategy;
import com.yoho.search.recall.scene.strategy.impls.CommonNewShopStrategy;
import com.yoho.search.recall.sort.strategy.*;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilder;
import org.springframework.stereotype.Component;
... ...
package com.yoho.search.recall.scene.request;
import com.yoho.search.recall.scene.config.RecallConstants;
import com.yoho.search.recall.scene.constants.RecallConstants;
import com.yoho.search.recall.scene.models.RecallRequest;
import com.yoho.search.recall.scene.persional.PersionalFactor;
import com.yoho.search.recall.scene.strategy.impls.SortPriceStrategy;
... ...
package com.yoho.search.recall.scene.strategy.impls;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.recall.scene.config.RecallConstants;
import com.yoho.search.recall.scene.constants.RecallConstants;
import com.yoho.search.recall.scene.helper.SortBuilderHelper;
import com.yoho.search.recall.scene.strategy.IStrategy;
import com.yoho.search.recall.scene.strategy.StrategyNameEnum;
... ...
package com.yoho.search.recall.scene.strategy.impls;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.recall.scene.config.RecallConstants;
import com.yoho.search.recall.scene.constants.RecallConstants;
import com.yoho.search.recall.scene.helper.SortBuilderHelper;
import com.yoho.search.recall.scene.strategy.IStrategy;
import com.yoho.search.recall.scene.strategy.StrategyNameEnum;
... ...
... ... @@ -2,7 +2,7 @@ package com.yoho.search.recall.scene.strategy.impls;
import com.yoho.search.base.utils.DateUtil;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.recall.scene.config.RecallConstants;
import com.yoho.search.recall.scene.constants.RecallConstants;
import com.yoho.search.recall.scene.helper.SortBuilderHelper;
import com.yoho.search.recall.scene.strategy.IStrategy;
import com.yoho.search.recall.scene.strategy.StrategyNameEnum;
... ...
package com.yoho.search.recall.scene.strategy.impls;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.recall.scene.config.RecallConstants;
import com.yoho.search.recall.scene.constants.RecallConstants;
import com.yoho.search.recall.scene.helper.SortBuilderHelper;
import com.yoho.search.recall.scene.strategy.IStrategy;
import com.yoho.search.recall.scene.strategy.StrategyNameEnum;
... ...
package com.yoho.search.recall.scene.strategy.impls;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.recall.scene.config.RecallConstants;
import com.yoho.search.recall.scene.constants.RecallConstants;
import com.yoho.search.recall.scene.helper.SortBuilderHelper;
import com.yoho.search.recall.scene.strategy.IStrategy;
import com.yoho.search.recall.scene.strategy.StrategyNameEnum;
... ... @@ -10,8 +10,6 @@ import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.sort.SortBuilder;
import java.util.List;
/**
* 直通车的召回
*
... ...
package com.yoho.search.recall.scene.strategy.impls;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.recall.scene.config.RecallConstants;
import com.yoho.search.recall.scene.constants.RecallConstants;
import com.yoho.search.recall.scene.helper.SortBuilderHelper;
import com.yoho.search.recall.scene.strategy.IStrategy;
import com.yoho.search.recall.scene.strategy.StrategyNameEnum;
... ...
package com.yoho.search.recall.scene.strategy.impls;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.recall.scene.config.RecallConstants;
import com.yoho.search.recall.scene.constants.RecallConstants;
import com.yoho.search.recall.scene.helper.SortBuilderHelper;
import com.yoho.search.recall.scene.strategy.IStrategy;
import com.yoho.search.recall.scene.strategy.StrategyNameEnum;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.sort.SortBuilder;
/**
... ...
... ... @@ -2,7 +2,7 @@ package com.yoho.search.recall.scene.strategy.impls;
import com.yoho.search.base.utils.DateUtil;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.recall.scene.config.RecallConstants;
import com.yoho.search.recall.scene.constants.RecallConstants;
import com.yoho.search.recall.scene.helper.SortBuilderHelper;
import com.yoho.search.recall.scene.strategy.IStrategy;
import com.yoho.search.recall.scene.strategy.StrategyNameEnum;
... ...
package com.yoho.search.recall.scene.strategy.impls;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.recall.scene.config.RecallConstants;
import com.yoho.search.recall.scene.constants.RecallConstants;
import com.yoho.search.recall.scene.helper.SortBuilderHelper;
import com.yoho.search.recall.scene.persional.PersionalFactor;
import com.yoho.search.recall.scene.strategy.IStrategy;
... ...