Authored by hugufei

解决促销列表召回类型的问题

... ... @@ -94,7 +94,7 @@ public class ProductListHelper {
/**
* 构建常见的列表返回对象
*/
public JSONObject buildProductListResult(SearchResult searchResult, int pageSize, boolean needReSort) {
public JSONObject buildProductListResult(SearchResult searchResult, int pageSize, boolean needReSort,NotRecallTypeEnum notRecallTypeEnum) {
JSONObject productListResult = new JSONObject();
productListResult.put("total", searchResult.getTotal());
productListResult.put("page", searchResult.getPage());
... ... @@ -104,6 +104,9 @@ public class ProductListHelper {
if (needReSort) {
productReturnInfoList = productListSortService.sortProductList(productReturnInfoList);
}
for (Map<String, Object> productInfo : productReturnInfoList) {
productInfo.put("recall_type", notRecallTypeEnum.name());
}
productListResult.put("product_list", productReturnInfoList);
return productListResult;
}
... ...
... ... @@ -10,6 +10,7 @@ import com.yoho.search.models.PromotionConditions;
import com.yoho.search.models.SearchApiResult;
import com.yoho.search.recall.scene.SceneRecallProductListService;
import com.yoho.search.recall.scene.beans.builder.UserRecallRequestBuilder;
import com.yoho.search.recall.scene.beans.strategy.NotRecallTypeEnum;
import com.yoho.search.recall.scene.models.req.UserRecallRequest;
import com.yoho.search.service.base.SearchCacheService;
import com.yoho.search.service.base.SearchCommonService;
... ... @@ -136,7 +137,7 @@ public class PromotionProductListService extends AbstractCacheAbleService {
}
// 7)构造返回结果
boolean needResort = searchCommonHelper.isOrderEmpty(paramMap);
JSONObject productListResult = productListHelper.buildProductListResult(searchResult, pageSize, needResort);
JSONObject productListResult = productListHelper.buildProductListResult(searchResult, pageSize, needResort,needResort? NotRecallTypeEnum.W2V_PERSIONAL:NotRecallTypeEnum.NOT_PERSIONAL);
// 10)将结果存进缓存
searchCacheService.addJSONObjectToCache(this.searchCache, productIndexName, searchParam, productListResult);
... ...
... ... @@ -10,6 +10,7 @@ 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.recall.scene.beans.strategy.NotRecallTypeEnum;
import com.yoho.search.service.base.SearchCommonService;
import com.yoho.search.service.base.index.ProductIndexBaseService;
import com.yoho.search.service.helper.ProductListHelper;
... ... @@ -65,7 +66,7 @@ public class ProductListServiceImpl implements IProductListService {
return new SearchApiResult().setCode(500).setMessage("execption");
}
// 3)构造返回结果
JSONObject productListResult = productListHelper.buildProductListResult(searchResult,searchParam.getSize(),false);
JSONObject productListResult = productListHelper.buildProductListResult(searchResult,searchParam.getSize(),false, NotRecallTypeEnum.NOT_PERSIONAL);
return new SearchApiResult().setData(productListResult);
} catch (Exception e) {
logger.error("[func=productListWithPhrase][params=" + paramMap + "]", e);
... ...