...
|
...
|
@@ -8,7 +8,7 @@ import com.yoho.search.core.es.model.SearchParam; |
|
|
import com.yoho.search.core.es.model.SearchResult;
|
|
|
import com.yoho.search.core.personalized.models.SortPriceArea;
|
|
|
import com.yoho.search.recall.scene.models.ParamQueryFilter;
|
|
|
import com.yoho.search.recall.scene.models.PagePersionalFactor;
|
|
|
import com.yoho.search.recall.scene.models.PagePersonalFactor;
|
|
|
import com.yoho.search.service.base.SearchCacheService;
|
|
|
import com.yoho.search.service.base.SearchCommonService;
|
|
|
import org.elasticsearch.search.aggregations.AbstractAggregationBuilder;
|
...
|
...
|
@@ -48,7 +48,7 @@ class PagePersionalFactorComponent { |
|
|
* @param paramQueryFilter
|
|
|
* @return
|
|
|
*/
|
|
|
public PagePersionalFactor queryPagePersionalFactor(ParamQueryFilter paramQueryFilter) {
|
|
|
public PagePersonalFactor queryPagePersionalFactor(ParamQueryFilter paramQueryFilter) {
|
|
|
//0、构造参数
|
|
|
SearchParam searchParam = new SearchParam();
|
|
|
searchParam.setQuery(paramQueryFilter.getParamQuery());
|
...
|
...
|
@@ -68,9 +68,9 @@ class PagePersionalFactorComponent { |
|
|
|
|
|
//3、缓存中获取
|
|
|
String cacheKey = searchCacheService.genSearchParamString(ISearchConstants.INDEX_NAME_PRODUCT_INDEX,searchParam);
|
|
|
PagePersionalFactor pagePagePersionalFactor = searchCacheService.getSerializableObjectFromCache(searchCache,cacheKey,PagePersionalFactor.class,true);
|
|
|
if(pagePagePersionalFactor !=null) {
|
|
|
return pagePagePersionalFactor;
|
|
|
PagePersonalFactor pagePagePersonalFactor = searchCacheService.getSerializableObjectFromCache(searchCache,cacheKey,PagePersonalFactor.class,true);
|
|
|
if(pagePagePersonalFactor !=null) {
|
|
|
return pagePagePersonalFactor;
|
|
|
}
|
|
|
|
|
|
//4、执行查询
|
...
|
...
|
@@ -80,10 +80,10 @@ class PagePersionalFactorComponent { |
|
|
Map<String, Aggregation> aggregationMap = searchResult.getAggMaps();
|
|
|
List<Integer> brandIds = this.getBrandIdsFromAggregationMap(aggregationMap);
|
|
|
List<SortPriceArea> sortPriceAreas = this.getSortPriceAreasFromAggregationMap(aggregationMap);
|
|
|
pagePagePersionalFactor = new PagePersionalFactor(brandIds, sortPriceAreas);
|
|
|
pagePagePersonalFactor = new PagePersonalFactor(brandIds, sortPriceAreas);
|
|
|
//6、加入缓存
|
|
|
searchCacheService.addSerializableObjectToCache(searchCache,cacheKey, pagePagePersionalFactor,true);
|
|
|
return pagePagePersionalFactor;
|
|
|
searchCacheService.addSerializableObjectToCache(searchCache,cacheKey, pagePagePersonalFactor,true);
|
|
|
return pagePagePersonalFactor;
|
|
|
}
|
|
|
|
|
|
private List<Integer> getBrandIdsFromAggregationMap(Map<String, Aggregation> aggregationMap) {
|
...
|
...
|
|