Authored by wangnan9279

去掉没有用的ufo suggest接口

@@ -56,13 +56,6 @@ public class UfoController { @@ -56,13 +56,6 @@ public class UfoController {
56 return ufoProductListService.recommendList(paramMap); 56 return ufoProductListService.recommendList(paramMap);
57 } 57 }
58 58
59 - @RequestMapping(method = RequestMethod.GET, value = "/ufo/suggestList")  
60 - @ResponseBody  
61 - public SearchApiResult suggestList(HttpServletRequest request) {  
62 - Map<String, String> paramMap = HttpServletRequestUtils.transParamType(request);  
63 - return ufoProductListService.suggestList(paramMap);  
64 - }  
65 -  
66 @RequestMapping(method = RequestMethod.GET, value = "/ufo/productListForPlatform") 59 @RequestMapping(method = RequestMethod.GET, value = "/ufo/productListForPlatform")
67 @ResponseBody 60 @ResponseBody
68 public SearchApiResult productListForPlatform(HttpServletRequest request) { 61 public SearchApiResult productListForPlatform(HttpServletRequest request) {
@@ -139,17 +139,6 @@ public class UfoSearchQueryHelper extends BaseService { @@ -139,17 +139,6 @@ public class UfoSearchQueryHelper extends BaseService {
139 return queryBuilder; 139 return queryBuilder;
140 } 140 }
141 141
142 -  
143 - public QueryBuilder constructSuggestQueryBuilder(Map<String, String> paramMap) {  
144 - // 0、处理查询关键字  
145 - String query = SearchKeyWordUtils.getUfoParamKeyword(paramMap, SearchRequestParams.UFOPRODUCTINDEX_SEARCH_QUERY);  
146 - if (StringUtils.isBlank(query)) {  
147 - return QueryBuilders.matchAllQuery();  
148 - }  
149 - WildcardQueryBuilder wildcardQueryBuilder = QueryBuilders.wildcardQuery(UfoProductIndexEsField.productName_ik, "*" + query + "*");  
150 - return wildcardQueryBuilder;  
151 - }  
152 -  
153 /** 142 /**
154 * 构造排序方式 143 * 构造排序方式
155 */ 144 */
@@ -86,18 +86,5 @@ public class UfoProductIndexBaseService { @@ -86,18 +86,5 @@ public class UfoProductIndexBaseService {
86 return productMap; 86 return productMap;
87 } 87 }
88 88
89 - public List<Map<String, Object>> buildSuggestReturnInfoList(List<Map<String, Object>> productEsSourceList) {  
90 - List<Map<String, Object>> results = new ArrayList<Map<String, Object>>();  
91 - for (Map<String, Object> productEsSource : productEsSourceList) {  
92 - results.add(this.getSuggestFromEsSource(productEsSource));  
93 - }  
94 - return results;  
95 - }  
96 -  
97 - public Map<String, Object> getSuggestFromEsSource(Map<String, Object> map) {  
98 - Map<String, Object> productMap = new HashMap<String, Object>();  
99 - productMap.put("product_name", MapUtils.getString(map, UfoProductIndexEsField.productName, ""));  
100 - return productMap;  
101 - }  
102 89
103 } 90 }
@@ -166,44 +166,6 @@ public class UfoProductListService { @@ -166,44 +166,6 @@ public class UfoProductListService {
166 } 166 }
167 } 167 }
168 168
169 - public SearchApiResult suggestList(Map<String, String> paramMap) {  
170 - try {  
171 - // 1、参数校验  
172 - int pageSize = StringUtils.isBlank(paramMap.get("viewNum")) ? 10 : Integer.parseInt(paramMap.get("viewNum"));  
173 - if (pageSize < 0) {  
174 - return new SearchApiResult().setCode(400).setMessage("viewNum参数不合法");  
175 - }  
176 - if (pageSize > 100) {  
177 - paramMap.put("viewNum", "100");  
178 - }  
179 - // 2. 构建SearchParam  
180 - SearchParam searchParam = new SearchParam();  
181 -  
182 - BoolQueryBuilder boolFilter = ufoSearchQueryHelper.constructFilterBuilder(paramMap, null);  
183 - searchParam.setFiter(boolFilter);  
184 - QueryBuilder queryBuilder = ufoSearchQueryHelper.constructSuggestQueryBuilder(paramMap);  
185 - searchParam.setQuery(queryBuilder);  
186 - searchParam.setAggregationBuilders(null);  
187 - searchParam.setSize(pageSize);  
188 - searchParam.setOffset(0);  
189 - // 设置返回的结果  
190 - List<String> includeFields = ufoProductIndexBaseService.getUfoProductIndexIncludeFields();  
191 - searchParam.setIncludeFields(includeFields);  
192 - // 执行搜索  
193 - SearchResult searchResult = searchCommonService.doSearch(ISearchConstants.INDEX_NAME_UFO_PRODUCT_INDEX, searchParam);  
194 - // 构造返回结果  
195 - List<Map<String, Object>> returnInfoList = ufoProductIndexBaseService.buildSuggestReturnInfoList(searchResult.getResultList());  
196 - JSONObject dataMap = new JSONObject();  
197 - dataMap.put("size", pageSize);  
198 - dataMap.put("total", searchResult.getTotalPage());  
199 - dataMap.put("suggest_list", returnInfoList);  
200 - return new SearchApiResult().setData(dataMap);  
201 - } catch (Exception e) {  
202 - logger.error(e.getMessage(), e);  
203 - return new SearchApiResult().setData(null).setCode(500);  
204 - }  
205 - }  
206 -  
207 public SearchApiResult productListForPlatform(Map<String, String> paramMap) { 169 public SearchApiResult productListForPlatform(Map<String, String> paramMap) {
208 try { 170 try {
209 // 2. 构建SearchParam 171 // 2. 构建SearchParam