Showing
1 changed file
with
1 additions
and
3 deletions
@@ -87,19 +87,17 @@ public class SearchProductsServiceNew { | @@ -87,19 +87,17 @@ public class SearchProductsServiceNew { | ||
87 | // 进行检索 | 87 | // 进行检索 |
88 | final String indexName = ISearchConstans.INDEX_NAME_PRODUCT_INDEX; | 88 | final String indexName = ISearchConstans.INDEX_NAME_PRODUCT_INDEX; |
89 | SearchResult searchResult = searchCommonService.doSearch(indexName, searchParam); | 89 | SearchResult searchResult = searchCommonService.doSearch(indexName, searchParam); |
90 | - | ||
91 | // 将searchResult转化为map返回--需要把aggregation转化为需要的结构 | 90 | // 将searchResult转化为map返回--需要把aggregation转化为需要的结构 |
92 | if (searchResult == null) { | 91 | if (searchResult == null) { |
93 | return null; | 92 | return null; |
94 | } | 93 | } |
95 | - | ||
96 | // 构造返回结果 | 94 | // 构造返回结果 |
97 | Map<String, Object> dataMap = new HashMap<String, Object>(); | 95 | Map<String, Object> dataMap = new HashMap<String, Object>(); |
98 | dataMap.put("total", searchResult.getTotal()); | 96 | dataMap.put("total", searchResult.getTotal()); |
99 | dataMap.put("page", searchResult.getPage()); | 97 | dataMap.put("page", searchResult.getPage()); |
100 | dataMap.put("page_total", searchResult.getTotalPage()); | 98 | dataMap.put("page_total", searchResult.getTotalPage()); |
101 | dataMap.put("product_list", searchServiceHelper.getProductMapList(searchResult.getResultList())); | 99 | dataMap.put("product_list", searchServiceHelper.getProductMapList(searchResult.getResultList())); |
102 | - if (searchResult.getAggMaps() != null) { | 100 | + if (paramMap.containsKey("needFilter") && "1".equals(paramMap.get("needFilter"))) { |
103 | dataMap.put("filter", buildFilterResult(aggregationResult, paramMap)); | 101 | dataMap.put("filter", buildFilterResult(aggregationResult, paramMap)); |
104 | } | 102 | } |
105 | Map<String, Object> jsonMap = new HashMap<String, Object>(); | 103 | Map<String, Object> jsonMap = new HashMap<String, Object>(); |
-
Please register or login to post a comment