|
|
package com.yoho.search.service.service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yoho.error.event.SearchEvent;
|
|
|
import com.yoho.search.base.utils.EventReportEnum;
|
|
|
import com.yoho.search.base.utils.ISearchConstants;
|
|
|
import com.yoho.search.core.es.agg.IAggregation;
|
|
|
import com.yoho.search.core.es.model.SearchParam;
|
|
|
import com.yoho.search.core.es.model.SearchResult;
|
|
|
import com.yoho.search.core.es.utils.IgnoreSomeException;
|
|
|
import com.yoho.search.service.aggregations.impls.AggregationFactoryService;
|
|
|
import com.yoho.search.service.service.helper.SearchServiceHelper;
|
|
|
import com.yoho.search.service.utils.SearchRequestParams;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.elasticsearch.index.query.BoolQueryBuilder;
|
|
|
import org.elasticsearch.index.query.QueryBuilder;
|
...
|
...
|
@@ -17,17 +23,10 @@ import org.springframework.context.ApplicationEventPublisher; |
|
|
import org.springframework.context.ApplicationEventPublisherAware;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yoho.error.event.SearchEvent;
|
|
|
import com.yoho.search.base.utils.EventReportEnum;
|
|
|
import com.yoho.search.base.utils.ISearchConstants;
|
|
|
import com.yoho.search.core.es.agg.IAggregation;
|
|
|
import com.yoho.search.core.es.model.SearchParam;
|
|
|
import com.yoho.search.core.es.model.SearchResult;
|
|
|
import com.yoho.search.core.es.utils.IgnoreSomeException;
|
|
|
import com.yoho.search.service.aggregations.impls.AggregationFactoryService;
|
|
|
import com.yoho.search.service.service.helper.SearchServiceHelper;
|
|
|
import com.yoho.search.service.utils.SearchRequestParams;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@Service
|
|
|
public class AggregationService implements ApplicationEventPublisherAware {
|
...
|
...
|
@@ -324,4 +323,29 @@ public class AggregationService implements ApplicationEventPublisherAware { |
|
|
return this.getAggNameAndResponse(isSecialofferAggregation, searchParam, paramMap, filterParamName);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取商品关键词的聚合,来源与风格、款式和属性。
|
|
|
*
|
|
|
* @param searchParam
|
|
|
* @param paramMap
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONObject getKeywordAggregationResult(SearchParam searchParam, Map<String, String> paramMap, int aggCount) throws Exception {
|
|
|
IAggregation keywordAggregation = aggregationFactoryService.getKeywordAggregation(aggCount);
|
|
|
return this.getAggNameAndResponse(keywordAggregation, searchParam, paramMap, null);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取商品关键词的聚合,来源与风格、款式和属性。
|
|
|
*
|
|
|
* @param searchParam
|
|
|
* @param paramMap
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONObject getShopAggregationResult(SearchParam searchParam, Map<String, String> paramMap, int aggCount) throws Exception {
|
|
|
IAggregation keywordAggregation = aggregationFactoryService.getShopAggregation(aggCount);
|
|
|
return this.getAggNameAndResponse(keywordAggregation, searchParam, paramMap, null);
|
|
|
}
|
|
|
} |
...
|
...
|
|