文档库--在结果中检索

This commit is contained in:
zhn
2022-03-25 22:07:40 +08:00
parent a2e6d96d5a
commit 59cb515466
@@ -140,9 +140,21 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
if(ObjectUtils.isNotEmpty(mapTwo)){
queryCondition(mapTwo, inputFieldList, otherFieldList, must);
}
//处理ids
JSONArray should = new JSONArray();
String ids = (String) mapTwo.get("ids");
if(StringUtils.isNotBlank(ids)){
for (String s : ids.split(",")) {
Map<String, Object> queryMap = new HashMap<>();
Map<String, Object> queryMapTemp = new HashMap<>();
queryMapTemp.put("id", s);
queryMap.put("match", queryMapTemp);
should.add(queryMap);
}
}
//列表
//封装查询条件
JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(must, null, null);
JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(must, null, should);
//1. 封装分页和字段值
JSONObject queryObject = jeroElasticsearchTemplate.buildQuery(sourceList, jsonObject, null, null,
Integer.parseInt(map.get("pageNo").toString()), Integer.parseInt(map.get("pageSize").toString()));
@@ -200,9 +212,9 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
String key = entry.getKey();
Object value = entry.getValue();
//处理二次搜索中选择列表数据
if("ids".equals(key) && ObjectUtils.isNotEmpty(value)){
inputMap.put("id", value);
}
// if("ids".equals(key) && ObjectUtils.isNotEmpty(value)){
// inputMap.put("id", value);
// }
if (inputFieldList.contains(key)) {
inputMap.put(key, value);
}