...
|
...
|
@@ -17,6 +17,7 @@ import com.yoho.search.recall.scene.models.req.UserRecallRequest; |
|
|
import com.yoho.search.recall.scene.models.req.UserRecallResponse;
|
|
|
import com.yoho.search.recall.scene.models.common.RecallSknInfo;
|
|
|
import com.yoho.search.service.base.SearchCommonService;
|
|
|
import com.yoho.search.service.base.SearchDynamicConfigService;
|
|
|
import com.yoho.search.service.helper.SearchCommonHelper;
|
|
|
import org.apache.commons.collections.MapUtils;
|
|
|
import org.elasticsearch.index.query.BoolQueryBuilder;
|
...
|
...
|
@@ -47,6 +48,8 @@ public class SceneRecallProductListService { |
|
|
private UserRecallRequestResponseCacheBean userRecallRequestResponseCacheBean;
|
|
|
@Autowired
|
|
|
private SknInfoResqusetResponseCacheBean sknInfoResqusetResponseCacheBean;
|
|
|
@Autowired
|
|
|
private SearchDynamicConfigService searchDynamicConfigService;
|
|
|
|
|
|
/**
|
|
|
* 个性化召回列表入口1
|
...
|
...
|
@@ -78,15 +81,21 @@ public class SceneRecallProductListService { |
|
|
* @return
|
|
|
*/
|
|
|
public SearchApiResult recallProductList(UserRecallRequest userRecallRequest, int page) {
|
|
|
//1、执行召回
|
|
|
//1、判断第一页是要需要查缓存【不查询缓存时,只添加缓存,以保证用户数据的实时性】
|
|
|
boolean ignoreQueryCache = false;
|
|
|
if(page==1 && !searchDynamicConfigService.searchPersionalNewStrategyFirstPageCacheOpen()){
|
|
|
ignoreQueryCache = true;
|
|
|
}
|
|
|
|
|
|
//2、执行召回
|
|
|
long begin = System.currentTimeMillis();
|
|
|
boolean ignoreQueryCache = page==1?true:false;//第一页不查缓存,只添加缓存,保证用户数据的实时性
|
|
|
UserRecallResponse userRecallResponse = userRecallRequestResponseCacheBean.queryRecallResult(userRecallRequest,ignoreQueryCache);
|
|
|
|
|
|
RECALL_NEW_LOGGER.info("RecallProductListService[1]-queryRecallResult,cost is [{}]", System.currentTimeMillis()-begin);
|
|
|
//2、根据召回结果查询商品信息
|
|
|
|
|
|
//3、根据召回结果查询商品信息
|
|
|
List<Map<String, Object>> productList = this.queryProductList(userRecallRequest, userRecallResponse,page, userRecallRequest.getPageSize());
|
|
|
//3、构造返回结果
|
|
|
|
|
|
//4、构造返回结果
|
|
|
JSONObject dataMap = new JSONObject();
|
|
|
dataMap.put("total", userRecallResponse.getTotal());
|
|
|
dataMap.put("page", page);
|
...
|
...
|
|