Authored by hugufei

重命名PagePersonalFactor

@@ -4,7 +4,6 @@ import com.yoho.search.core.personalized.models.SortPriceArea; @@ -4,7 +4,6 @@ import com.yoho.search.core.personalized.models.SortPriceArea;
4 import com.yoho.search.recall.scene.constants.SknCountConstants; 4 import com.yoho.search.recall.scene.constants.SknCountConstants;
5 import com.yoho.search.recall.scene.models.ParamQueryFilter; 5 import com.yoho.search.recall.scene.models.ParamQueryFilter;
6 import com.yoho.search.recall.scene.models.RecallRequest; 6 import com.yoho.search.recall.scene.models.RecallRequest;
7 -import com.yoho.search.recall.scene.models.PagePersionalFactor;  
8 import com.yoho.search.recall.scene.beans.strategy.impls.SortPriceStrategy; 7 import com.yoho.search.recall.scene.beans.strategy.impls.SortPriceStrategy;
9 import org.springframework.stereotype.Component; 8 import org.springframework.stereotype.Component;
10 9
@@ -3,7 +3,6 @@ package com.yoho.search.recall.scene.beans.helper; @@ -3,7 +3,6 @@ package com.yoho.search.recall.scene.beans.helper;
3 import com.yoho.search.base.utils.DateUtil; 3 import com.yoho.search.base.utils.DateUtil;
4 import com.yoho.search.base.utils.ProductIndexEsField; 4 import com.yoho.search.base.utils.ProductIndexEsField;
5 import com.yoho.search.core.personalized.models.SortPriceArea; 5 import com.yoho.search.core.personalized.models.SortPriceArea;
6 -import com.yoho.search.recall.scene.models.PagePersionalFactor;  
7 import org.apache.lucene.search.join.ScoreMode; 6 import org.apache.lucene.search.join.ScoreMode;
8 import org.elasticsearch.index.query.BoolQueryBuilder; 7 import org.elasticsearch.index.query.BoolQueryBuilder;
9 import org.elasticsearch.index.query.QueryBuilder; 8 import org.elasticsearch.index.query.QueryBuilder;
@@ -8,7 +8,7 @@ import com.yoho.search.core.es.model.SearchParam; @@ -8,7 +8,7 @@ import com.yoho.search.core.es.model.SearchParam;
8 import com.yoho.search.core.es.model.SearchResult; 8 import com.yoho.search.core.es.model.SearchResult;
9 import com.yoho.search.core.personalized.models.SortPriceArea; 9 import com.yoho.search.core.personalized.models.SortPriceArea;
10 import com.yoho.search.recall.scene.models.ParamQueryFilter; 10 import com.yoho.search.recall.scene.models.ParamQueryFilter;
11 -import com.yoho.search.recall.scene.models.PagePersionalFactor; 11 +import com.yoho.search.recall.scene.models.PagePersonalFactor;
12 import com.yoho.search.service.base.SearchCacheService; 12 import com.yoho.search.service.base.SearchCacheService;
13 import com.yoho.search.service.base.SearchCommonService; 13 import com.yoho.search.service.base.SearchCommonService;
14 import org.elasticsearch.search.aggregations.AbstractAggregationBuilder; 14 import org.elasticsearch.search.aggregations.AbstractAggregationBuilder;
@@ -48,7 +48,7 @@ class PagePersionalFactorComponent { @@ -48,7 +48,7 @@ class PagePersionalFactorComponent {
48 * @param paramQueryFilter 48 * @param paramQueryFilter
49 * @return 49 * @return
50 */ 50 */
51 - public PagePersionalFactor queryPagePersionalFactor(ParamQueryFilter paramQueryFilter) { 51 + public PagePersonalFactor queryPagePersionalFactor(ParamQueryFilter paramQueryFilter) {
52 //0、构造参数 52 //0、构造参数
53 SearchParam searchParam = new SearchParam(); 53 SearchParam searchParam = new SearchParam();
54 searchParam.setQuery(paramQueryFilter.getParamQuery()); 54 searchParam.setQuery(paramQueryFilter.getParamQuery());
@@ -68,9 +68,9 @@ class PagePersionalFactorComponent { @@ -68,9 +68,9 @@ class PagePersionalFactorComponent {
68 68
69 //3、缓存中获取 69 //3、缓存中获取
70 String cacheKey = searchCacheService.genSearchParamString(ISearchConstants.INDEX_NAME_PRODUCT_INDEX,searchParam); 70 String cacheKey = searchCacheService.genSearchParamString(ISearchConstants.INDEX_NAME_PRODUCT_INDEX,searchParam);
71 - PagePersionalFactor pagePagePersionalFactor = searchCacheService.getSerializableObjectFromCache(searchCache,cacheKey,PagePersionalFactor.class,true);  
72 - if(pagePagePersionalFactor !=null) {  
73 - return pagePagePersionalFactor; 71 + PagePersonalFactor pagePagePersonalFactor = searchCacheService.getSerializableObjectFromCache(searchCache,cacheKey,PagePersonalFactor.class,true);
  72 + if(pagePagePersonalFactor !=null) {
  73 + return pagePagePersonalFactor;
74 } 74 }
75 75
76 //4、执行查询 76 //4、执行查询
@@ -80,10 +80,10 @@ class PagePersionalFactorComponent { @@ -80,10 +80,10 @@ class PagePersionalFactorComponent {
80 Map<String, Aggregation> aggregationMap = searchResult.getAggMaps(); 80 Map<String, Aggregation> aggregationMap = searchResult.getAggMaps();
81 List<Integer> brandIds = this.getBrandIdsFromAggregationMap(aggregationMap); 81 List<Integer> brandIds = this.getBrandIdsFromAggregationMap(aggregationMap);
82 List<SortPriceArea> sortPriceAreas = this.getSortPriceAreasFromAggregationMap(aggregationMap); 82 List<SortPriceArea> sortPriceAreas = this.getSortPriceAreasFromAggregationMap(aggregationMap);
83 - pagePagePersionalFactor = new PagePersionalFactor(brandIds, sortPriceAreas); 83 + pagePagePersonalFactor = new PagePersonalFactor(brandIds, sortPriceAreas);
84 //6、加入缓存 84 //6、加入缓存
85 - searchCacheService.addSerializableObjectToCache(searchCache,cacheKey, pagePagePersionalFactor,true);  
86 - return pagePagePersionalFactor; 85 + searchCacheService.addSerializableObjectToCache(searchCache,cacheKey, pagePagePersonalFactor,true);
  86 + return pagePagePersonalFactor;
87 } 87 }
88 88
89 private List<Integer> getBrandIdsFromAggregationMap(Map<String, Aggregation> aggregationMap) { 89 private List<Integer> getBrandIdsFromAggregationMap(Map<String, Aggregation> aggregationMap) {
@@ -4,7 +4,7 @@ import com.yoho.search.base.utils.CollectionUtils; @@ -4,7 +4,7 @@ import com.yoho.search.base.utils.CollectionUtils;
4 import com.yoho.search.base.utils.Transfer; 4 import com.yoho.search.base.utils.Transfer;
5 import com.yoho.search.core.personalized.models.SortPriceArea; 5 import com.yoho.search.core.personalized.models.SortPriceArea;
6 import com.yoho.search.core.personalized.models.UserPersonalFactorRsp; 6 import com.yoho.search.core.personalized.models.UserPersonalFactorRsp;
7 -import com.yoho.search.recall.scene.models.PagePersionalFactor; 7 +import com.yoho.search.recall.scene.models.PagePersonalFactor;
8 import com.yoho.search.recall.scene.models.RecallParams; 8 import com.yoho.search.recall.scene.models.RecallParams;
9 import org.slf4j.Logger; 9 import org.slf4j.Logger;
10 import org.slf4j.LoggerFactory; 10 import org.slf4j.LoggerFactory;
@@ -34,7 +34,7 @@ public class QueryUserPersionalFactorBean { @@ -34,7 +34,7 @@ public class QueryUserPersionalFactorBean {
34 public UserPersonalFactorRsp queryPersionalFactor(RecallParams recallParams) { 34 public UserPersonalFactorRsp queryPersionalFactor(RecallParams recallParams) {
35 try { 35 try {
36 //1、获取页面上的个性化因子 36 //1、获取页面上的个性化因子
37 - PagePersionalFactor pageFactor = pageComponent.queryPagePersionalFactor(recallParams.getParamQueryFilter()); 37 + PagePersonalFactor pageFactor = pageComponent.queryPagePersionalFactor(recallParams.getParamQueryFilter());
38 //2、获取用户的个性化因子 38 //2、获取用户的个性化因子
39 UserPersonalFactorRsp userFactor = userComponent.queryUserPersionalFactor(recallParams.getUid(), recallParams.getUdid()); 39 UserPersonalFactorRsp userFactor = userComponent.queryUserPersionalFactor(recallParams.getUid(), recallParams.getUdid());
40 //3、join获取最终的结果 40 //3、join获取最终的结果
@@ -5,7 +5,6 @@ import com.yoho.search.core.personalized.models.SortPriceArea; @@ -5,7 +5,6 @@ import com.yoho.search.core.personalized.models.SortPriceArea;
5 import com.yoho.search.recall.scene.constants.CacheTimeConstants; 5 import com.yoho.search.recall.scene.constants.CacheTimeConstants;
6 import com.yoho.search.recall.scene.beans.helper.ExtendFilterHelper; 6 import com.yoho.search.recall.scene.beans.helper.ExtendFilterHelper;
7 import com.yoho.search.recall.scene.beans.helper.SortBuilderHelper; 7 import com.yoho.search.recall.scene.beans.helper.SortBuilderHelper;
8 -import com.yoho.search.recall.scene.models.PagePersionalFactor;  
9 import com.yoho.search.recall.scene.beans.strategy.IStrategy; 8 import com.yoho.search.recall.scene.beans.strategy.IStrategy;
10 import com.yoho.search.recall.scene.beans.strategy.StrategyNameEnum; 9 import com.yoho.search.recall.scene.beans.strategy.StrategyNameEnum;
11 import org.elasticsearch.index.query.QueryBuilder; 10 import org.elasticsearch.index.query.QueryBuilder;
@@ -8,17 +8,17 @@ import java.util.List; @@ -8,17 +8,17 @@ import java.util.List;
8 /** 8 /**
9 * 个性化因子参数 9 * 个性化因子参数
10 */ 10 */
11 -public class PagePersionalFactor implements Serializable{ 11 +public class PagePersonalFactor implements Serializable{
12 12
13 private static final long serialVersionUID = 89030356435559223L; 13 private static final long serialVersionUID = 89030356435559223L;
14 14
15 private List<Integer> brandIds; 15 private List<Integer> brandIds;
16 private List<SortPriceArea> sortPriceAreas; 16 private List<SortPriceArea> sortPriceAreas;
17 17
18 - public PagePersionalFactor() { 18 + public PagePersonalFactor() {
19 } 19 }
20 20
21 - public PagePersionalFactor(List<Integer> brandIds, List<SortPriceArea> sortPriceAreas){ 21 + public PagePersonalFactor(List<Integer> brandIds, List<SortPriceArea> sortPriceAreas){
22 this.brandIds = brandIds; 22 this.brandIds = brandIds;
23 this.sortPriceAreas = sortPriceAreas; 23 this.sortPriceAreas = sortPriceAreas;
24 } 24 }