Authored by hugufei

使用新对象构造页面的聚合元素

... ... @@ -18,9 +18,6 @@ import java.util.Map;
@Component
public class RecallMergerResultBuilder {
@Autowired
private QueryProductVectorInfoCacheBean queryProductVectorInfoCacheBean;
/**
* 召回结果构造器
*
... ... @@ -32,9 +29,7 @@ public class RecallMergerResultBuilder {
long total = this.getTotalCount(requestResponses);
//2、skn去重
List<RecallMergerResult.SknResult> sknResults = this.distinctRecallSkn(requestResponses);
//3、填充向量
this.fillProductFactors(sknResults);
//4、返回召回结果
//3、返回召回结果
return new RecallMergerResult(total, sknResults);
}
... ... @@ -100,18 +95,4 @@ public class RecallMergerResultBuilder {
return sknResults;
}
private void fillProductFactors(List<RecallMergerResult.SknResult> sknResults) {
//1、请求构造
List<Integer> skns = new ArrayList<>();
for (RecallMergerResult.SknResult sknResult : sknResults) {
skns.add(sknResult.getProductSkn());
}
//2、执行查询
Map<Integer, String> productFactors = queryProductVectorInfoCacheBean.querySknVectors(skns);
//3、填充向量
for (RecallMergerResult.SknResult sknResult : sknResults) {
sknResult.setFactor(MapUtils.getString(productFactors,sknResult.getProductSkn(),""));
}
}
}
... ...
package com.yoho.search.recall.scene.beans.builder;
import com.yoho.search.base.utils.CollectionUtils;
import com.yoho.search.base.utils.Transfer;
import com.yoho.search.core.personalized.PersonalizedSearch;
import com.yoho.search.core.personalized.models.SortPriceArea;
import com.yoho.search.core.personalized.models.UserPersonalFactorRsp;
import com.yoho.search.recall.performance.beans.ProductFeatureFactorHepler;
import com.yoho.search.recall.performance.model.CommonRecallResult;
import com.yoho.search.recall.performance.model.CommonRecallSkn;
import com.yoho.search.recall.performance.model.UserFeatureFactor;
import com.yoho.search.recall.scene.beans.cache.QueryProductVectorInfoCacheBean;
import com.yoho.search.recall.scene.beans.strategy.StrategyNameEnum;
import com.yoho.search.recall.scene.models.RecallMergerResult;
import com.yoho.search.recall.scene.models.RecallParams;
... ... @@ -35,6 +38,8 @@ public class RecallResultBuilder {
private PersonalVectorFeatureSearch personalVectorFeatureSearch;
@Autowired
private ProductFeatureFactorHepler productFeatureFactorHepler;
@Autowired
private QueryProductVectorInfoCacheBean queryProductVectorInfoCacheBean;
public RecallResult builderRecallResult(RecallMergerResult recallMergerResult, RecallParams param, UserPersonalFactorRsp userPersonalFactorRsp){
//1、获取总数
... ... @@ -43,16 +48,19 @@ public class RecallResultBuilder {
//2、获取召回结果中的所有skn
List<RecallMergerResult.SknResult> sknResultList = recallMergerResult.getSknList();
//3、按相关性计算得分
//3、填充skn向量
sknResultList = this.fillProductFactors(sknResultList);
//4、按相关性计算得分
sknResultList = this.doCalScoreAndSort(sknResultList,param.getUid());
//4、品牌品类平衡
//5、品牌品类平衡
sknResultList = this.doBalance(sknResultList);
//5、处理firstSkn-直通车等信息
//6、处理firstSkn-直通车等信息
sknResultList = this.doReRank(sknResultList);
//6、截取整数页
//7、分页处理
int pageSize = param.getPageSize();
int recallTotalPage = (sknResultList.size() / pageSize);
if (recallTotalPage == 0) {
... ... @@ -63,7 +71,7 @@ public class RecallResultBuilder {
}
sknResultList = CollectionUtils.safeSubList(sknResultList,0,recallTotalPage * param.getPageSize());
//7、构造返回结果
//8、构造返回结果
List<RecallSknInfo> sknList = new ArrayList<>();
for (RecallMergerResult.SknResult sknResult:sknResultList){
sknList.add(new RecallSknInfo(sknResult.getProductSkn(),sknResult.getRequestType()));
... ... @@ -73,6 +81,26 @@ public class RecallResultBuilder {
}
/**
* 查询skn的向量
* @param sknResults
* @return
*/
private List<RecallMergerResult.SknResult> fillProductFactors(List<RecallMergerResult.SknResult> sknResults) {
//1、请求构造
List<Integer> skns = new ArrayList<>();
for (RecallMergerResult.SknResult sknResult : sknResults) {
skns.add(sknResult.getProductSkn());
}
//2、执行查询
Map<Integer, String> productFactors = queryProductVectorInfoCacheBean.querySknVectors(skns);
//3、填充向量
for (RecallMergerResult.SknResult sknResult : sknResults) {
sknResult.setFactor(MapUtils.getString(productFactors,sknResult.getProductSkn(),""));
}
return sknResults;
}
/**
* 粗排-按相关性计算得分,并按得分排序
* @param sknResultList
* @param uid
... ... @@ -88,13 +116,8 @@ public class RecallResultBuilder {
double score = productFeatureFactorHepler.calProductFeatureFactor(userFeatureFactor, sknResult.getFactor());
sknResult.setScore(score);
}
//3、按得分排序
Collections.sort(sknResultList, new Comparator<RecallMergerResult.SknResult>() {
@Override
public int compare(RecallMergerResult.SknResult o1, RecallMergerResult.SknResult o2) {
return o2.getScore().compareTo(o1.getScore());// 大的排前面
}
});
//3、按得分排序-得分高的在前面
Collections.sort(sknResultList,(o1,o2)-> o2.getScore().compareTo(o1.getScore()));
return sknResultList;
}
... ...
... ... @@ -6,9 +6,12 @@ import com.yoho.search.common.cache.SearchCacheFactory;
import com.yoho.search.common.cache.model.SearchCache;
import com.yoho.search.core.es.model.SearchParam;
import com.yoho.search.core.es.model.SearchResult;
import com.yoho.search.core.personalized.models.SortBrand;
import com.yoho.search.core.personalized.models.SortPriceArea;
import com.yoho.search.recall.scene.models.ParamQueryFilter;
import com.yoho.search.recall.scene.models.PagePersonalFactor;
import com.yoho.search.recall.scene.models.personal.PagePersonalFactor;
import com.yoho.search.recall.scene.models.personal.PageSortBrand;
import com.yoho.search.recall.scene.models.personal.PageSortPriceArea;
import com.yoho.search.service.base.SearchCacheService;
import com.yoho.search.service.base.SearchCommonService;
import org.elasticsearch.search.aggregations.AbstractAggregationBuilder;
... ... @@ -20,10 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.*;
@Component
class PagePersionalFactorComponent {
... ... @@ -49,21 +49,17 @@ class PagePersionalFactorComponent {
* @return
*/
public PagePersonalFactor queryPagePersionalFactor(ParamQueryFilter paramQueryFilter) {
//0、构造参数
//1、构造参数
SearchParam searchParam = new SearchParam();
searchParam.setQuery(paramQueryFilter.getParamQuery());
searchParam.setFiter(paramQueryFilter.getParamFilter());
searchParam.setSize(0);
List<AbstractAggregationBuilder<?>> aggregationBuilders = new ArrayList<>();
//1、品牌id聚合
aggregationBuilders.add(AggregationBuilders.terms("brandIdAgg").field(ProductIndexEsField.brandId).size(200));//品牌id聚合
//2、品类价格带聚合
TermsAggregationBuilder middleAggBuilder = AggregationBuilders.terms("middleSortIdAgg").field(ProductIndexEsField.middleSortId).size(100);
TermsAggregationBuilder genderAggBuilder = AggregationBuilders.terms("priceAreaAgg").field(ProductIndexEsField.priceArea).size(7);
middleAggBuilder.subAggregation(genderAggBuilder);
aggregationBuilders.add(middleAggBuilder);//品类性格聚合
//2、构造聚合参数
List<AbstractAggregationBuilder<?>> aggregationBuilders = new ArrayList<>();
aggregationBuilders.add(brandIdAggBuilder());//品牌id聚合
aggregationBuilders.add(sortPriceAreaAggBuilder());//品类-价格带聚合
aggregationBuilders.add(sortBrandAggBuilder());//品类-品牌聚合
searchParam.setAggregationBuilders(aggregationBuilders);
//3、缓存中获取
... ... @@ -79,15 +75,25 @@ class PagePersionalFactorComponent {
//5、构造结果
Map<String, Aggregation> aggregationMap = searchResult.getAggMaps();
List<Integer> brandIds = this.getBrandIdsFromAggregationMap(aggregationMap);
List<SortPriceArea> sortPriceAreas = this.getSortPriceAreasFromAggregationMap(aggregationMap);
pagePagePersonalFactor = new PagePersonalFactor(brandIds, sortPriceAreas);
List<PageSortPriceArea> sortPriceAreas = this.getSortPriceAreasFromAggregationMap(aggregationMap);
List<PageSortBrand> sortBrands = this.getSortBrandsFromAggregationMap(aggregationMap);
pagePagePersonalFactor = new PagePersonalFactor(brandIds, sortPriceAreas,sortBrands);
//6、加入缓存
searchCacheService.addSerializableObjectToCache(searchCache,cacheKey, pagePagePersonalFactor,true);
return pagePagePersonalFactor;
}
/**
* 品牌id聚合
* @return
*/
private TermsAggregationBuilder brandIdAggBuilder() {
return AggregationBuilders.terms("brandIdAgg").field(ProductIndexEsField.brandId).size(200);
}
private List<Integer> getBrandIdsFromAggregationMap(Map<String, Aggregation> aggregationMap) {
List<Integer> brandIds = new ArrayList<Integer>();
List<Integer> brandIds = new ArrayList<>();
MultiBucketsAggregation aggregation = (MultiBucketsAggregation) aggregationMap.get("brandIdAgg");
if (aggregation == null) {
return brandIds;
... ... @@ -101,29 +107,89 @@ class PagePersionalFactorComponent {
return brandIds;
}
private List<SortPriceArea> getSortPriceAreasFromAggregationMap(Map<String, Aggregation> aggregationMap) {
List<SortPriceArea> sortPrices = new ArrayList<>();
MultiBucketsAggregation aggregation = (MultiBucketsAggregation) aggregationMap.get("middleSortIdAgg");
if (aggregation == null) {
return new ArrayList<>();
/**
* 品类-价格带聚合
* @return
*/
private TermsAggregationBuilder sortPriceAreaAggBuilder() {
TermsAggregationBuilder middleSortAggBuilder = AggregationBuilders.terms("sortPriceMiddleSortIdAgg").field(ProductIndexEsField.middleSortId).size(100);
TermsAggregationBuilder priceAreaAggBuilder = AggregationBuilders.terms("sortPricePriceAreaAgg").field(ProductIndexEsField.priceArea).size(10);
middleSortAggBuilder.subAggregation(priceAreaAggBuilder);
return middleSortAggBuilder;
}
private List<PageSortPriceArea> getSortPriceAreasFromAggregationMap(Map<String, Aggregation> aggregationMap) {
Map<Integer,List<Integer>> sortPriceAreaMap = this.getValueFromAggregationMap(aggregationMap,"sortPriceMiddleSortIdAgg","sortPricePriceAreaAgg");
List<PageSortPriceArea> sortPrices = new ArrayList<>();
for (Map.Entry<Integer,List<Integer>> entry: sortPriceAreaMap.entrySet()) {
Integer middleSortId = entry.getKey();
List<Integer> priceAreas = entry.getValue();
sortPrices.add(new PageSortPriceArea(middleSortId,priceAreas));
}
return sortPrices;
}
/**
* 品类-品牌聚合
*
* @return
*/
private TermsAggregationBuilder sortBrandAggBuilder() {
TermsAggregationBuilder middleSortAggBuilder = AggregationBuilders.terms("sortBrandMiddleSortIdAgg").field(ProductIndexEsField.middleSortId).size(100);
middleSortAggBuilder.subAggregation(AggregationBuilders.terms("sortBrandBrandIdAgg").field(ProductIndexEsField.brandId).size(200));
return middleSortAggBuilder;
}
private List<PageSortBrand> getSortBrandsFromAggregationMap(Map<String, Aggregation> aggregationMap) {
Map<Integer,List<Integer>> sortBrandMap = this.getValueFromAggregationMap(aggregationMap,"sortBrandMiddleSortIdAgg","sortBrandBrandIdAgg");
List<PageSortBrand> pageSortBrands = new ArrayList<>();
for (Map.Entry<Integer,List<Integer>> entry: sortBrandMap.entrySet()) {
Integer middleSortId = entry.getKey();
List<Integer> brandIds = entry.getValue();
pageSortBrands.add(new PageSortBrand(middleSortId,brandIds));
}
Iterator<? extends MultiBucketsAggregation.Bucket> iterator = aggregation.getBuckets().iterator();
while (iterator.hasNext()) {
MultiBucketsAggregation.Bucket middleSortIdBucket = iterator.next();
Integer middleSortId = Integer.valueOf(middleSortIdBucket.getKeyAsString());
return pageSortBrands;
}
MultiBucketsAggregation priceAreaAggregation = ((MultiBucketsAggregation) middleSortIdBucket.getAggregations().asMap().get("priceAreaAgg"));
if(priceAreaAggregation==null){
/**
* 从聚合结果中获取参数,仅支持二层聚合
* @param aggregationMap
* @param firstAggName
* @param secondAggName
* @return
*/
private Map<Integer,List<Integer>> getValueFromAggregationMap(Map<String, Aggregation> aggregationMap,String firstAggName,String secondAggName){
Map<Integer,List<Integer>> aggResultMap = new HashMap<>();
if(!aggregationMap.containsKey(firstAggName)){
return aggResultMap;
}
MultiBucketsAggregation firstAggregation = (MultiBucketsAggregation) aggregationMap.get(firstAggName);
Iterator<? extends MultiBucketsAggregation.Bucket> firstAggregationIterator = firstAggregation.getBuckets().iterator();
while (firstAggregationIterator.hasNext()) {
MultiBucketsAggregation.Bucket firstAggregationBucket = firstAggregationIterator.next();
Integer firstAggregationBucketKey = Integer.valueOf(firstAggregationBucket.getKeyAsString());
Map<String, Aggregation> secondAggregationMap = firstAggregationBucket.getAggregations().asMap();
if(secondAggregationMap==null || !secondAggregationMap.containsKey(secondAggName)){
continue;
}
Iterator<? extends MultiBucketsAggregation.Bucket> priceAreaIterator = priceAreaAggregation.getBuckets().iterator();
while (priceAreaIterator.hasNext()) {
MultiBucketsAggregation.Bucket genderBucket = priceAreaIterator.next();
Integer priceArea = Integer.valueOf(genderBucket.getKeyAsString());
sortPrices.add(new SortPriceArea(middleSortId, priceArea));
}
List<Integer> secondAggregationBucketKeys = this.getAggValuesFromMultiBucketsAggregation((MultiBucketsAggregation)secondAggregationMap.get(secondAggName));
aggResultMap.put(firstAggregationBucketKey,secondAggregationBucketKeys);
}
return sortPrices;
return aggResultMap;
}
private List<Integer> getAggValuesFromMultiBucketsAggregation(MultiBucketsAggregation aggregation){
List<Integer> results = new ArrayList<>();
if(aggregation==null){
return results;
}
Iterator<? extends MultiBucketsAggregation.Bucket> bucketsIterator = aggregation.getBuckets().iterator();
while (bucketsIterator.hasNext()) {
MultiBucketsAggregation.Bucket bucket = bucketsIterator.next();
Integer value = Integer.valueOf(bucket.getKeyAsString());
results.add(value);
}
return results;
}
}
... ...
... ... @@ -5,16 +5,16 @@ import com.yoho.search.base.utils.CollectionUtils;
import com.yoho.search.base.utils.Transfer;
import com.yoho.search.core.personalized.models.SortPriceArea;
import com.yoho.search.core.personalized.models.UserPersonalFactorRsp;
import com.yoho.search.recall.scene.models.PagePersonalFactor;
import com.yoho.search.recall.scene.constants.RecallCommonConstants;
import com.yoho.search.recall.scene.models.personal.PagePersonalFactor;
import com.yoho.search.recall.scene.models.RecallParams;
import com.yoho.search.recall.scene.models.personal.PageSortPriceArea;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.*;
@Component
public class QueryUserPersionalFactorBean {
... ... @@ -39,60 +39,73 @@ public class QueryUserPersionalFactorBean {
//1、获取页面上的个性化因子
long begin = System.currentTimeMillis();
PagePersonalFactor pageFactor = pageComponent.queryPagePersionalFactor(recallParams.getParamQueryFilter());
RECALL_NEW_LOGGER.info("queryPagePersionalFactor . cost is[{}]",System.currentTimeMillis()-begin);
RECALL_NEW_LOGGER.info("queryPagePersionalFactor . cost is[{}]", System.currentTimeMillis() - begin);
//2、获取用户的个性化因子
begin = System.currentTimeMillis();
UserPersonalFactorRsp userFactor = userComponent.queryUserPersionalFactor(recallParams.getUid(), recallParams.getUdid());
RECALL_NEW_LOGGER.info("queryUserPersionalFactor . cost is[{}]",System.currentTimeMillis()-begin);
RECALL_NEW_LOGGER.info("queryUserPersionalFactor . cost is[{}]", System.currentTimeMillis() - begin);
//3、join获取最终的结果
begin = System.currentTimeMillis();
List<Integer> brandIds = this.innerJoin(pageFactor.getBrandIds(),userFactor.getBrandIds(),brandIdMapkeyTransfer,15);
List<SortPriceArea> sortPriceAreas = this.innerJoin(pageFactor.getSortPriceAreas(),userFactor.getSortPriceAreas(),sortPriceMapkeyTransfer,10);
UserPersonalFactorRsp userPersonalFactorRsp = new UserPersonalFactorRsp(brandIds, sortPriceAreas,userFactor.getVector());
RECALL_NEW_LOGGER.info("innerJoinFactor . cost is[{}],uid is[{}], data is [{}] ", System.currentTimeMillis()-begin,recallParams.getUid(), JSON.toJSONString(userPersonalFactorRsp));
List<Integer> brandIds = this.getBrandListWithSort(pageFactor, userFactor);
List<SortPriceArea> sortPriceAreas = this.getSortPriceAreaWithSort(pageFactor, userFactor);
//4、构造UserPersonalFactorRsp
UserPersonalFactorRsp userPersonalFactorRsp = new UserPersonalFactorRsp(brandIds, sortPriceAreas, userFactor.getVector());
RECALL_NEW_LOGGER.info("innerJoinFactor . cost is[{}],uid is[{}], data is [{}] ", System.currentTimeMillis() - begin, recallParams.getUid(), JSON.toJSONString(userPersonalFactorRsp));
return userPersonalFactorRsp;
}catch (Exception e){
logger.error(e.getMessage(),e);
return new UserPersonalFactorRsp(new ArrayList<>(),new ArrayList<>(),"");
} catch (Exception e) {
logger.error(e.getMessage(), e);
return new UserPersonalFactorRsp(new ArrayList<>(), new ArrayList<>(), "");
}
}
static Transfer<Integer,String> brandIdMapkeyTransfer = new Transfer<Integer, String>() {
@Override
public String transfer(Integer brandId) {
return String.valueOf(brandId);
/**
* 按顺序截取品牌
* @param pageFactor
* @param userFactor
* @return
*/
private List<Integer> getBrandListWithSort(PagePersonalFactor pageFactor, UserPersonalFactorRsp userFactor){
List<Integer> pageBrandIds = pageFactor.getBrandIds();
List<Integer> userBrandIds = userFactor.getBrandIds();
List<Integer> results = new ArrayList<>();
for (Integer brandId : userBrandIds) {
if (pageBrandIds.contains(brandId)) {
results.add(brandId);
}
if (results.size() >= RecallCommonConstants.MAX_JOIN_BRANDID){
break;
}
}
};
return results;
}
static Transfer<SortPriceArea,String> sortPriceMapkeyTransfer = new Transfer<SortPriceArea, String>() {
@Override
public String transfer(SortPriceArea sortPriceArea) {
StringBuilder sb = new StringBuilder();
sb.append(sortPriceArea.getMiddleSortId());
sb.append(":");
sb.append(sortPriceArea.getPriceArea());
return sb.toString();
/**
* 按顺序截取品类-价格带
* @param pageFactor
* @param userFactor
* @return
*/
private List<SortPriceArea> getSortPriceAreaWithSort(PagePersonalFactor pageFactor, UserPersonalFactorRsp userFactor){
List<PageSortPriceArea> pageSortPriceAreas = pageFactor.getSortPriceAreas();
Map<Integer,List<Integer>> sortPriceAreaMap = new HashMap<>();
for (PageSortPriceArea pageSortPriceArea: pageSortPriceAreas) {
sortPriceAreaMap.put(pageSortPriceArea.getMiddleSortId(),pageSortPriceArea.getPriceAreas());
}
};
private <T> List<T> innerJoin(List<T> aList, List<T> bList, Transfer<T,String> mapKeyTransfer,int size) {
try {
Map<String,T> aKeyValueMap = CollectionUtils.toMap(aList,mapKeyTransfer);
List<T> results = new ArrayList<T>();
for (T b : bList) {
String bKey = mapKeyTransfer.transfer(b);
if (aKeyValueMap.containsKey(bKey)) {
results.add(aKeyValueMap.get(bKey));
}
if (results.size() >= size) {
break;
}
List<SortPriceArea> results = new ArrayList<>();
for (SortPriceArea sortPriceArea : userFactor.getSortPriceAreas()) {
if(!sortPriceAreaMap.containsKey(sortPriceArea.getMiddleSortId())){
continue;
}
List<Integer> priceArea = sortPriceAreaMap.get(sortPriceArea.getMiddleSortId());
if(priceArea==null || !priceArea.contains(sortPriceArea.getPriceArea())){
continue;
}
results.add(sortPriceArea);
if (results.size() >= RecallCommonConstants.MAX_JOIN_SORT_BRAND){
break;
}
return results;
}catch (Exception e){
logger.error(e.getMessage(),e);
return new ArrayList<>();
}
return results;
}
}
... ...
package com.yoho.search.recall.scene.constants;
public class RecallCommonConstants {
public static final int MAX_JOIN_BRANDID = 20;
public static final int MAX_JOIN_SORT_PRICE = 10;
public static final int MAX_JOIN_SORT_BRAND= 50;
}
... ...
... ... @@ -28,6 +28,7 @@ public class RecallMergerResult {
private Integer productSkn;
private Integer brandId;
private Integer middleSortId;
private Integer priceArea;
private String requestType;
private String factor;
private Double score;
... ... @@ -36,6 +37,7 @@ public class RecallMergerResult {
this.productSkn = recallSkn.getSkn();
this.brandId = recallSkn.getBdId();
this.middleSortId = recallSkn.getMisId();
this.priceArea = recallSkn.getPa();
}
public Integer getProductSkn() {
... ... @@ -50,29 +52,35 @@ public class RecallMergerResult {
return middleSortId;
}
public String getRequestType() {
return requestType;
public Integer getPriceArea() {
return priceArea;
}
public void setRequestType(String requestType) {
this.requestType = requestType;
}
public Double getScore() {
return score;
public String getRequestType() {
return requestType;
}
public void setScore(Double score) {
this.score = score;
}
public String getFactor() {
return factor;
public Double getScore() {
return score;
}
public void setFactor(String factor) {
this.factor = factor;
}
public String getFactor() {
return factor;
}
}
}
... ...
... ... @@ -46,14 +46,16 @@ public class RecallResponse implements Serializable {
private Integer skn;
private Integer bdId;
private Integer misId;
private Integer pa;
public RecallSkn() {
}
public RecallSkn(Integer productSkn, Integer brandId, Integer middleSortId) {
public RecallSkn(Integer productSkn, Integer brandId, Integer middleSortId,Integer pa) {
this.skn = productSkn;
this.bdId = brandId;
this.misId = middleSortId;
this.pa = pa;
}
public Integer getSkn() {
... ... @@ -79,6 +81,14 @@ public class RecallResponse implements Serializable {
public void setMisId(Integer misId) {
this.misId = misId;
}
public Integer getPa() {
return pa;
}
public void setPa(Integer pa) {
this.pa = pa;
}
}
}
... ...
package com.yoho.search.recall.scene.models.personal;
import com.yoho.search.core.personalized.models.SortBrand;
import com.yoho.search.core.personalized.models.SortPriceArea;
import java.io.Serializable;
import java.util.List;
/**
* 个性化因子参数
*/
public class PagePersonalFactor implements Serializable{
private static final long serialVersionUID = 89030356435559223L;
private List<Integer> brandIds;
private List<PageSortPriceArea> sortPriceAreas;
private List<PageSortBrand> sortBrands;
public PagePersonalFactor() {
}
public PagePersonalFactor(List<Integer> brandIds, List<PageSortPriceArea> sortPriceAreas,List<PageSortBrand> sortBrands){
this.brandIds = brandIds;
this.sortPriceAreas = sortPriceAreas;
this.sortBrands = sortBrands;
}
public List<Integer> getBrandIds() {
return brandIds;
}
public void setBrandIds(List<Integer> brandIds) {
this.brandIds = brandIds;
}
public List<PageSortPriceArea> getSortPriceAreas() {
return sortPriceAreas;
}
public void setSortPriceAreas(List<PageSortPriceArea> sortPriceAreas) {
this.sortPriceAreas = sortPriceAreas;
}
public List<PageSortBrand> getSortBrands() {
return sortBrands;
}
public void setSortBrands(List<PageSortBrand> sortBrands) {
this.sortBrands = sortBrands;
}
}
... ...
package com.yoho.search.recall.scene.models.personal;
import java.io.Serializable;
import java.util.List;
public class PageSortBrand implements Serializable {
private static final long serialVersionUID = 6155493513881738094L;
private Integer middleSortId;
private List<Integer> brandIds;
public PageSortBrand() {
}
public PageSortBrand(Integer middleSortId, List<Integer> brandIds) {
this.middleSortId = middleSortId;
this.brandIds = brandIds;
}
public Integer getMiddleSortId() {
return middleSortId;
}
public void setMiddleSortId(Integer middleSortId) {
this.middleSortId = middleSortId;
}
public List<Integer> getBrandIds() {
return brandIds;
}
public void setBrandIds(List<Integer> brandIds) {
this.brandIds = brandIds;
}
}
... ...
package com.yoho.search.recall.scene.models.personal;
import java.io.Serializable;
import java.util.List;
/**
* 页面中的品类-价格带
*/
public class PageSortPriceArea implements Serializable {
private static final long serialVersionUID = 596977708473811201L;
public PageSortPriceArea() {
}
public PageSortPriceArea(Integer middleSortId, List<Integer> priceAreas) {
this.middleSortId = middleSortId;
this.priceAreas = priceAreas;
}
private Integer middleSortId;
private List<Integer> priceAreas;
public Integer getMiddleSortId() {
return middleSortId;
}
public void setMiddleSortId(Integer middleSortId) {
this.middleSortId = middleSortId;
}
public List<Integer> getPriceAreas() {
return priceAreas;
}
public void setPriceAreas(List<Integer> priceAreas) {
this.priceAreas = priceAreas;
}
}
... ...
... ... @@ -47,6 +47,7 @@ public class AggCommonHelper {
return results;
}
/**
* 获取tophit的聚合结果
*
... ...