文档库--列表中选中数据后再结果中搜索

This commit is contained in:
zhn
2022-03-25 23:10:52 +08:00
parent 239a0ff14b
commit 84ad1f61fc
@@ -488,7 +488,7 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
} }
Integer pageNo = searchVO.getPage(); Integer pageNo = searchVO.getPage();
Integer pageSize = searchVO.getPageSize(); Integer pageSize = searchVO.getPageSize();
IPage page = getiPage(selectValue, selectValueTwo, queryMapJson, pageNo, pageSize); IPage page = getiPage(selectValue, selectValueTwo, queryMapJson,null, pageNo, pageSize,null);
return page; return page;
@@ -496,9 +496,14 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
} }
@NotNull @NotNull
private IPage getiPage(String selectValue, String selectValueTwo, JSONArray queryMapJson, Integer pageNo, Integer pageSize) { private IPage getiPage(String selectValue, String selectValueTwo, JSONArray queryMapJson,JSONArray should, Integer pageNo, Integer pageSize,String paragraphFlag) {
JSONObject jsonObject = new JSONObject();
//基础添加封装 //基础添加封装
JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(null, null, queryMapJson); if("paragraphFlag".equals(paragraphFlag)){
jsonObject = jeroElasticsearchTemplate.buildBoolQuery(queryMapJson, null, should);
}else{
jsonObject = jeroElasticsearchTemplate.buildBoolQuery(null, null, queryMapJson);
}
//全部 //全部
//1. 条件,分页 //1. 条件,分页
JSONObject queryObject = jeroElasticsearchTemplate.buildQuery(null, JSONObject queryObject = jeroElasticsearchTemplate.buildQuery(null,
@@ -752,6 +757,19 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
if(ObjectUtils.isNotEmpty(mapTwo)){ if(ObjectUtils.isNotEmpty(mapTwo)){
queryCondition(mapTwo, inputFieldList, otherFieldList, must); 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);
}
}
int pageNo = Integer.parseInt(map.get("pageNo").toString()); int pageNo = Integer.parseInt(map.get("pageNo").toString());
int pageSize = Integer.parseInt(map.get("pageSize").toString()); int pageSize = Integer.parseInt(map.get("pageSize").toString());
//判断第一次传参和第二次传参 inputFieldList //判断第一次传参和第二次传参 inputFieldList
@@ -771,9 +789,11 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
selectValueTwo = value; selectValueTwo = value;
} }
} }
//段落的标识
String paragraphFlag = "paragraphFlag";
IPage iPage = getiPage(selectValue, selectValueTwo, must, pageNo, pageSize); IPage iPage = getiPage(selectValue, selectValueTwo, must,should, pageNo, pageSize,paragraphFlag);
return iPage; return iPage;
} }