suggestList内部接口查询时改为multiMatchQuery
Showing
1 changed file
with
6 additions
and
1 deletions
@@ -271,7 +271,12 @@ public class SuggestServiceImpl implements ISuggestService, ApplicationEventPubl | @@ -271,7 +271,12 @@ public class SuggestServiceImpl implements ISuggestService, ApplicationEventPubl | ||
271 | if (StringUtils.isNotEmpty(queryWord)) { | 271 | if (StringUtils.isNotEmpty(queryWord)) { |
272 | // 是否精确匹配 | 272 | // 是否精确匹配 |
273 | String accurateQuery = paramMap.get("accurate"); | 273 | String accurateQuery = paramMap.get("accurate"); |
274 | - queryBuilder = "Y".equalsIgnoreCase(accurateQuery) ? QueryBuilders.matchQuery("standardKeyword", CharUtils.standardized(queryWord)) : QueryBuilders.matchQuery("keyword.keyword_ik", queryWord); | 274 | + if ("Y".equalsIgnoreCase(accurateQuery)) { |
275 | + queryBuilder = QueryBuilders.matchQuery("standardKeyword", CharUtils.standardized(queryWord)); | ||
276 | + } else { | ||
277 | + queryBuilder = QueryBuilders.multiMatchQuery(queryWord.trim().toLowerCase(), "keyword", "keyword.keyword_lowercase", | ||
278 | + "keyword.keyword_pinyin", "keyword.keyword_jianpin", "keyword.keyword_ik"); | ||
279 | + } | ||
275 | } | 280 | } |
276 | 281 | ||
277 | searchParam.setQuery(queryBuilder); | 282 | searchParam.setQuery(queryBuilder); |
-
Please register or login to post a comment