文档库--搜索全部修改

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");
JSONArray queryMapJson = new JSONArray();
for (String field : fieldList) {
Map<String, Object> queryMap = new HashMap<>();
Map<String, Object> map2 = new HashMap<>();
map2.put(field, selectValue);
queryMap.put("match", map2);
queryMapJson.add(queryMap);
if(StringUtils.isNotBlank(selectValue)){
for (String field : fieldList) {
Map<String, Object> queryMap = new HashMap<>();
Map<String, Object> map2 = new HashMap<>();
map2.put(field, selectValue);
queryMap.put("match", map2);
queryMapJson.add(queryMap);
}
}
//基础添加封装
JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(null, null, queryMapJson);
//全部