Authored by 胡古飞

店铺内找相似小于4条则不返回

... ... @@ -123,11 +123,14 @@ public class SearchLikeInShopServiceImpl implements ISearchLikeInShopService {
}
// 9、执行搜索
SearchResult searchResult = searchCommonService.doSearch(ISearchConstants.INDEX_NAME_PRODUCT_INDEX, searchParam);
if (searchResult == null) {
return new SearchApiResult().setData(null);
List<Map<String, Object>> productList = null;
if (searchResult != null) {
productList = searchServiceHelper.getProductMapList(searchResult.getResultList());
}
//低于4条不返回
if(productList==null || productList.size()<4){
productList = new ArrayList<Map<String,Object>>();
}
// 10、构造返回结果并加入缓存
List<Map<String, Object>> productList = searchServiceHelper.getProductMapList(searchResult.getResultList());
jsonObject = new JSONObject();
jsonObject.put("page", 1);
jsonObject.put("page_total", 1);
... ...