...
|
...
|
@@ -10,6 +10,8 @@ import com.yoho.search.core.es.model.SearchParam; |
|
|
import com.yoho.search.core.es.model.SearchResult;
|
|
|
import com.yoho.search.models.SearchApiResult;
|
|
|
import com.yoho.search.service.helper.ProductListHelper;
|
|
|
import com.yoho.search.service.helper.SearchParamHelper;
|
|
|
import com.yoho.search.service.index.ProductIndexBaseService;
|
|
|
import com.yoho.search.service.recall.beans.strategy.NotRecallTypeEnum;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.slf4j.Logger;
|
...
|
...
|
@@ -23,6 +25,8 @@ import java.util.List; |
|
|
import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import static java.util.stream.Collectors.joining;
|
|
|
|
|
|
/**
|
|
|
* @author wangnan
|
|
|
* @version 2018/10/15
|
...
|
...
|
@@ -36,6 +40,10 @@ public class ProductListBySknService { |
|
|
private SearchCommonService searchCommonService;
|
|
|
@Autowired
|
|
|
private ProductListHelper productListHelper;
|
|
|
@Autowired
|
|
|
private SearchParamHelper searchParamHelper;
|
|
|
@Autowired
|
|
|
private ProductIndexBaseService productIndexBaseService;
|
|
|
|
|
|
@SearchCacheAble(cacheInMinute = 10, cacheName = "PRODUCT_LIST_BY_SKN")
|
|
|
public SearchApiResult productListBySkn(Map<String, String> paramMap) {
|
...
|
...
|
@@ -48,7 +56,14 @@ public class ProductListBySknService { |
|
|
// 1)构造搜索参数
|
|
|
List<String> sknList = Arrays.asList(paramMap.get(SearchRequestParams.PARAM_SEARCH_PRODUCT_SKN).split(","));
|
|
|
sknList = sknList.size() > 100 ? sknList.subList(0, 100) : sknList;
|
|
|
SearchParam searchParam = productListHelper.buildProductListBySknSearchParam(paramMap, sknList.size());
|
|
|
String productSknParam = sknList.stream().collect(joining(","));
|
|
|
paramMap.put(SearchRequestParams.PARAM_SEARCH_PRODUCT_SKN,productSknParam);
|
|
|
SearchParam searchParam = searchParamHelper.buildWithPersional(paramMap, false);
|
|
|
searchParam.setAggregationBuilders(null);
|
|
|
searchParam.setSize(100);
|
|
|
searchParam.setOffset(0);
|
|
|
List<String> includeFields = productIndexBaseService.getProductIndexIncludeFields();
|
|
|
searchParam.setIncludeFields(includeFields);
|
|
|
|
|
|
// 2)查询ES
|
|
|
SearchResult searchResult = searchCommonService.doSearch(ISearchConstants.INDEX_NAME_PRODUCT_INDEX, searchParam);
|
...
|
...
|
|