|
|
package com.yoho.search.service.scene.guang;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yoho.search.aop.cache.SearchCacheAble;
|
|
|
import com.yoho.search.base.utils.ISearchConstants;
|
|
|
import com.yoho.search.common.SearchCommonService;
|
|
|
import com.yoho.search.common.utils.SearchApiResultUtils;
|
|
|
import com.yoho.search.core.es.model.SearchParam;
|
|
|
import com.yoho.search.core.es.model.SearchResult;
|
|
|
import com.yoho.search.core.es.utils.SearchParamUtils;
|
|
|
import com.yoho.search.models.SearchApiResult;
|
|
|
import com.yoho.search.service.recall.beans.strategy.NotRecallTypeEnum;
|
|
|
import com.yoho.search.common.SearchCommonService;
|
|
|
import com.yoho.search.service.helper.ProductListHelper;
|
|
|
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
|
|
import com.yoho.search.service.recall.beans.strategy.NotRecallTypeEnum;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
...
|
...
|
@@ -21,30 +18,15 @@ import org.springframework.stereotype.Service; |
|
|
import java.util.Map;
|
|
|
|
|
|
@Service
|
|
|
public class ProductListService {
|
|
|
public class ProductListWithPhraseService {
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(ProductListService.class);
|
|
|
private static final Logger logger = LoggerFactory.getLogger(ProductListWithPhraseService.class);
|
|
|
|
|
|
@Autowired
|
|
|
private SearchCommonService searchCommonService;
|
|
|
@Autowired
|
|
|
private ProductListHelper productListHelper;
|
|
|
|
|
|
public SearchApiResult getESDsl(Map<String, String> paramMap) {
|
|
|
logger.info("[func=getESDsl][param={}]", paramMap);
|
|
|
try {
|
|
|
SearchParam searchParam = productListHelper.buildProductListSearchParam(paramMap, true);
|
|
|
SearchSourceBuilder searchSourceBuilder = SearchParamUtils.genSearchSourceBuilderFromSearchParam(searchParam);
|
|
|
SearchApiResult searchApiResult = new SearchApiResult();
|
|
|
String results = searchSourceBuilder.toString();
|
|
|
searchApiResult.setData(JSON.parseObject(results));
|
|
|
logger.info("[func=getESDsl][dsl=\n{}]", searchApiResult.getData());
|
|
|
return searchApiResult;
|
|
|
} catch (Exception e) {
|
|
|
return SearchApiResultUtils.errorSearchApiResult("getESDsl", paramMap, e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@SearchCacheAble(cacheInMinute = 10, cacheName = "PRODUCT_LIST_WITH_PHRASE")
|
|
|
public SearchApiResult productListWithPhrase(Map<String, String> paramMap) {
|
|
|
try {
|
...
|
...
|
|