文档库--搜索全部修改

This commit is contained in:
zhn
2022-03-21 17:01:23 +08:00
parent 9b13e2ff6f
commit 7d21525891
@@ -290,14 +290,17 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
fieldList.add("content"); fieldList.add("content");
JSONArray queryMapJson = new JSONArray(); JSONArray queryMapJson = new JSONArray();
for (String field : fieldList) { if(StringUtils.isNotBlank(selectValue)){
Map<String, Object> queryMap = new HashMap<>(); for (String field : fieldList) {
Map<String, Object> map2 = new HashMap<>(); Map<String, Object> queryMap = new HashMap<>();
map2.put(field, selectValue); Map<String, Object> map2 = new HashMap<>();
queryMap.put("match", map2); map2.put(field, selectValue);
queryMapJson.add(queryMap); queryMap.put("match", map2);
queryMapJson.add(queryMap);
}
} }
//基础添加封装 //基础添加封装
JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(null, null, queryMapJson); JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(null, null, queryMapJson);
//全部 //全部