搜索中心--在结果中查询修改
This commit is contained in:
+67
-202
@@ -94,7 +94,6 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
|||||||
map.put("db_field_name", "file_text");
|
map.put("db_field_name", "file_text");
|
||||||
mapList.add(map);
|
mapList.add(map);
|
||||||
}
|
}
|
||||||
//type = 0时,查询下拉,树形,日期等字段 type = 1时,查询输入框字段
|
|
||||||
return mapList;
|
return mapList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -259,9 +258,6 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
|||||||
String key = entry.getKey();
|
String key = entry.getKey();
|
||||||
Object value = entry.getValue();
|
Object value = entry.getValue();
|
||||||
//处理二次搜索中选择列表数据
|
//处理二次搜索中选择列表数据
|
||||||
// if("ids".equals(key) && ObjectUtils.isNotEmpty(value)){
|
|
||||||
// inputMap.put("id", value);
|
|
||||||
// }
|
|
||||||
if (inputFieldList.contains(key)) {
|
if (inputFieldList.contains(key)) {
|
||||||
inputMap.put(key, value);
|
inputMap.put(key, value);
|
||||||
}
|
}
|
||||||
@@ -304,161 +300,6 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// @Override
|
|
||||||
// public IPage getInfoList(Map<String, Object> mapOne,Map<String,Object> mapTwoTwo) {
|
|
||||||
// boolean flagTemp = jeroElasticsearchTemplate.indexExists(SearchEnum.INDEX_NAME_DOCUMENT.getValue());
|
|
||||||
// if(!flagTemp){
|
|
||||||
// return new Page(Integer.parseInt(map.get("pageNo").toString()), Integer.parseInt(map.get("pageSize").toString()));
|
|
||||||
// }
|
|
||||||
// //文档库所有的字段
|
|
||||||
// List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(ModuleEnum.DOCUMENT_LIBRARY.getValue());
|
|
||||||
// //需要查询的列表字段
|
|
||||||
// List<OnlCgformField> hearOnlCgformFieldList = fieldList.stream()
|
|
||||||
// .filter(e -> YesOrNoEnum.YES.getValue().equals(e.getIsShowSearch())).collect(Collectors.toList());
|
|
||||||
// List<String> sourceList = hearOnlCgformFieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
|
|
||||||
// sourceList.add("id");
|
|
||||||
//
|
|
||||||
// //输入框字段
|
|
||||||
// List<OnlCgformField> inputOnlCgformFieldList = fieldList.stream()
|
|
||||||
// .filter(e -> FieldTypeEnum.TEXT_STRING.getValue().equals(e.getFieldShowType())
|
|
||||||
// || FieldTypeEnum.TEXT_NUMBER.getValue().equals(e.getFieldShowType()))
|
|
||||||
// .collect(Collectors.toList());
|
|
||||||
// List<String> inputFieldList = inputOnlCgformFieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
|
|
||||||
// //下拉,树形,日期等字段
|
|
||||||
// List<OnlCgformField> otherOnlCgformFieldList = fieldList.stream()
|
|
||||||
// .filter(e -> FieldTypeEnum.PULL_SINGLE.getValue().equals(e.getFieldShowType())//下拉单选
|
|
||||||
// || FieldTypeEnum.PULL_MORE.getValue().equals(e.getFieldShowType())//下拉多选
|
|
||||||
// || FieldTypeEnum.DATE_SINGLE.getValue().equals(e.getFieldShowType())//日期单选
|
|
||||||
// || FieldTypeEnum.DATE_MORE.getValue().equals(e.getFieldShowType())//日期多选
|
|
||||||
// || FieldTypeEnum.TREE.getValue().equals(e.getFieldShowType()))//树形
|
|
||||||
// .collect(Collectors.toList());
|
|
||||||
// List<String> otherFieldList = otherOnlCgformFieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
|
|
||||||
//
|
|
||||||
// //过滤出下拉选
|
|
||||||
// List<OnlCgformField> onlCgformFieldList = fieldList.stream()
|
|
||||||
// .filter(e -> FieldTypeEnum.PULL_SINGLE.getValue().equals(e.getFieldShowType())
|
|
||||||
// || FieldTypeEnum.PULL_MORE.getValue().equals(e.getFieldShowType()))
|
|
||||||
// .collect(Collectors.toList());
|
|
||||||
// //过滤出文件类型字段
|
|
||||||
// List<OnlCgformField> onlCgformFieldFileList = fieldList.stream()
|
|
||||||
// .filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType()))
|
|
||||||
// .collect(Collectors.toList());
|
|
||||||
// //文件字段
|
|
||||||
// List<String> FieldFileList = onlCgformFieldFileList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
|
|
||||||
// sourceList.addAll(FieldFileList);
|
|
||||||
//
|
|
||||||
// //下拉选字段
|
|
||||||
// List<String> fieldPullList = onlCgformFieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
|
|
||||||
//
|
|
||||||
// //过滤出树形字段
|
|
||||||
// List<OnlCgformField> treeFieldList = fieldList.stream()
|
|
||||||
// .filter(e -> FieldTypeEnum.TREE.getValue().equals(e.getFieldShowType()))
|
|
||||||
// .collect(Collectors.toList());
|
|
||||||
//
|
|
||||||
// Map<String, Object> inputMap = new HashMap<>();//条件内容为输入框的
|
|
||||||
// Map<String, Object> otherMap = new HashMap<>();//条件内容为下拉,日期,树形
|
|
||||||
// //区分输入框和下拉,树形,日期等字段
|
|
||||||
// if (ObjectUtils.isNotEmpty(map)) {
|
|
||||||
// for (Map.Entry<String, Object> entry : map.entrySet()) {
|
|
||||||
// String key = entry.getKey();
|
|
||||||
// Object value = entry.getValue();
|
|
||||||
// //二次搜索中选择列表数据的情况
|
|
||||||
// if("ids".equals(key) && StringUtils.isNotBlank((String)value)){
|
|
||||||
// inputMap.put("id", value);
|
|
||||||
// }
|
|
||||||
// if (inputFieldList.contains(key)) {
|
|
||||||
// inputMap.put(key, value);
|
|
||||||
// }
|
|
||||||
// if (otherFieldList.contains(key)) {
|
|
||||||
// otherMap.put(key, value);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// JSONArray should = new JSONArray();
|
|
||||||
// JSONArray must = new JSONArray();
|
|
||||||
// //封装输入框查询条件
|
|
||||||
// if (ObjectUtils.isNotEmpty(inputMap)) {
|
|
||||||
// for (Map.Entry<String, Object> entry : inputMap.entrySet()) {
|
|
||||||
//
|
|
||||||
// String key = entry.getKey();
|
|
||||||
// String value = (String )entry.getValue();
|
|
||||||
//// value = "车,机动";
|
|
||||||
// if(ObjectUtils.isNotEmpty(value)){
|
|
||||||
// for (String s : value.split(",")) {
|
|
||||||
// Map<String, Object> queryMap = new HashMap<>();
|
|
||||||
// Map<String, Object> queryMapTemp = new HashMap<>();
|
|
||||||
// queryMapTemp.put(key, s);
|
|
||||||
// queryMap.put("match_phrase", queryMapTemp);
|
|
||||||
// must.add(queryMap);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// //封装下拉,树形,日期查询条件
|
|
||||||
// if (ObjectUtils.isNotEmpty(otherMap)) {
|
|
||||||
// for (Map.Entry<String, Object> entry : otherMap.entrySet()) {
|
|
||||||
// String key = entry.getKey();
|
|
||||||
// String value = (String) entry.getValue();
|
|
||||||
//// value = "1";
|
|
||||||
// if(ObjectUtils.isNotEmpty(value)){
|
|
||||||
// for (String s : value.split(",")) {
|
|
||||||
// Map<String, Object> queryMap = new HashMap<>();
|
|
||||||
// Map<String, Object> queryMapTemp = new HashMap<>();
|
|
||||||
// queryMapTemp.put(key, s);
|
|
||||||
// queryMap.put("match_phrase", queryMapTemp);
|
|
||||||
// must.add(queryMap);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// //列表
|
|
||||||
// //封装查询条件
|
|
||||||
// JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(must, null, null);
|
|
||||||
// //1. 封装分页和字段值
|
|
||||||
// JSONObject queryObject = jeroElasticsearchTemplate.buildQuery(sourceList, jsonObject, null, null, Integer.parseInt(map.get("pageNo").toString()), Integer.parseInt(map.get("pageSize").toString()));
|
|
||||||
// //2. 数据查询
|
|
||||||
// JSONObject search = jeroElasticsearchTemplate.search(SearchEnum.INDEX_NAME_DOCUMENT.getValue(), SearchEnum.TYPE_NAME_DOCUMENT.getValue(), queryObject);
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// //处理数据字典
|
|
||||||
// List<SysDictItem> sysDictItems = sysDictItemServiceImpl.selectItemsAll();//下拉数据字典
|
|
||||||
// List<SysCategory> categoryList = sysCategoryService.list();//树形数据字典
|
|
||||||
// List<Map<String, Object>> list = (List<Map<String, Object>>) (((Map) search.get("hits")).get("hits"));
|
|
||||||
// List<Map<String, Object>> mapList = new ArrayList<>();
|
|
||||||
// for (Map<String, Object> stringObjectMap : list) {
|
|
||||||
// Map<String, Object> mapTemp = (Map<String, Object>) stringObjectMap.get("_source");
|
|
||||||
// //格式化时间字段
|
|
||||||
// solveTime(mapTemp);
|
|
||||||
// mapList.add(mapTemp);
|
|
||||||
// List<OSSFile> fileList = new ArrayList<>();
|
|
||||||
// mapTemp.entrySet().forEach(entry -> {
|
|
||||||
// //下拉选处理数据字典
|
|
||||||
// bussDocumentLibraryEOService.treeDictItem(categoryList, entry, treeFieldList, (String) map.get("cut"));
|
|
||||||
//
|
|
||||||
// //下拉单选和下拉多选数据字典处理
|
|
||||||
// if (fieldPullList.contains(entry.getKey())) {
|
|
||||||
// bussDocumentLibraryEOService.dictItem(sysDictItems, entry, onlCgformFieldList, (String) map.get("cut"));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// //处理文件
|
|
||||||
// if (FieldFileList.contains(entry.getKey())) {
|
|
||||||
// List<OSSFile> fileInfos = iOSSFileService.getFileInfos((String) entry.getValue());
|
|
||||||
// if (fileInfos.size() > 0) {
|
|
||||||
// for (OSSFile fileInfo : fileInfos) {
|
|
||||||
// fileList.add(fileInfo);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// });
|
|
||||||
// mapTemp.put("file_name", fileList);
|
|
||||||
// }
|
|
||||||
// IPage page = new Page(Integer.parseInt(map.get("pageNo").toString()), Integer.parseInt(map.get("pageSize").toString()));
|
|
||||||
// page.setTotal(Long.parseLong(String.valueOf(((Map) search.get("hits")).get("total"))));
|
|
||||||
// page.setRecords(mapList);
|
|
||||||
// return page;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage getFullTextInfoList(SearchVO searchVO) {
|
public IPage getFullTextInfoList(SearchVO searchVO) {
|
||||||
@@ -473,7 +314,6 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
|||||||
if (!flagTemp) {
|
if (!flagTemp) {
|
||||||
return new Page(searchVO.getPageNo(), searchVO.getPageSize());
|
return new Page(searchVO.getPageNo(), searchVO.getPageSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
String selectValue = searchVO.getSelectValue();
|
String selectValue = searchVO.getSelectValue();
|
||||||
String selectValueTwo = searchVO.getSelectValueTwo();
|
String selectValueTwo = searchVO.getSelectValueTwo();
|
||||||
//不查询高亮字段
|
//不查询高亮字段
|
||||||
@@ -488,7 +328,9 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
|||||||
fieldList.add("id");
|
fieldList.add("id");
|
||||||
JSONArray queryMapJson = new JSONArray();
|
JSONArray queryMapJson = new JSONArray();
|
||||||
JSONArray queryMapJsonTwo = new JSONArray();
|
JSONArray queryMapJsonTwo = new JSONArray();
|
||||||
|
JSONArray queryMapJsonThree = new JSONArray();
|
||||||
JSONArray queryMapJsonAll = new JSONArray();
|
JSONArray queryMapJsonAll = new JSONArray();
|
||||||
|
//封装首次的条件
|
||||||
if (StringUtils.isNotBlank(selectValue)) {
|
if (StringUtils.isNotBlank(selectValue)) {
|
||||||
for (String field : fieldList) {
|
for (String field : fieldList) {
|
||||||
Map<String, Object> queryMap = new HashMap<>();
|
Map<String, Object> queryMap = new HashMap<>();
|
||||||
@@ -502,7 +344,7 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
|||||||
JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(null, null, queryMapJson);
|
JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(null, null, queryMapJson);
|
||||||
queryMapJsonAll.add(jsonObject);
|
queryMapJsonAll.add(jsonObject);
|
||||||
}
|
}
|
||||||
|
//封装二次的条件
|
||||||
if (StringUtils.isNotBlank(selectValueTwo)) {
|
if (StringUtils.isNotBlank(selectValueTwo)) {
|
||||||
for (String field : fieldList) {
|
for (String field : fieldList) {
|
||||||
Map<String, Object> queryMap = new HashMap<>();
|
Map<String, Object> queryMap = new HashMap<>();
|
||||||
@@ -512,29 +354,28 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
|||||||
queryMapJsonTwo.add(queryMap);
|
queryMapJsonTwo.add(queryMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//处理二次查询中选择了课表数据进行查询的情况
|
if(CollectionUtils.isNotEmpty(queryMapJsonTwo)){
|
||||||
|
JSONObject jsonObjectTwo = jeroElasticsearchTemplate.buildBoolQuery(null, null, queryMapJsonTwo);
|
||||||
|
queryMapJsonAll.add(jsonObjectTwo);
|
||||||
|
}
|
||||||
|
//ids进行三次封装
|
||||||
if (StringUtils.isNotBlank(searchVO.getIds())) {
|
if (StringUtils.isNotBlank(searchVO.getIds())) {
|
||||||
for (String s : searchVO.getIds().split(",")) {
|
for (String s : searchVO.getIds().split(",")) {
|
||||||
Map<String, Object> queryMap = new HashMap<>();
|
Map<String, Object> queryMap = new HashMap<>();
|
||||||
Map<String, Object> queryMapTemp = new HashMap<>();
|
Map<String, Object> queryMapTemp = new HashMap<>();
|
||||||
queryMapTemp.put("id", s);
|
queryMapTemp.put("id", s);
|
||||||
queryMap.put("match_phrase", queryMapTemp);
|
queryMap.put("match_phrase", queryMapTemp);
|
||||||
queryMapJsonTwo.add(queryMap);
|
queryMapJsonThree.add(queryMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(CollectionUtils.isNotEmpty(queryMapJsonThree)){
|
||||||
|
JSONObject jsonObjectThree = jeroElasticsearchTemplate.buildBoolQuery(null, null, queryMapJsonThree);
|
||||||
|
queryMapJsonAll.add(jsonObjectThree);
|
||||||
|
}
|
||||||
Integer pageNo = searchVO.getPageNo();
|
Integer pageNo = searchVO.getPageNo();
|
||||||
Integer pageSize = searchVO.getPageSize();
|
Integer pageSize = searchVO.getPageSize();
|
||||||
//封装二次查询
|
|
||||||
if(CollectionUtils.isNotEmpty(queryMapJsonTwo)){
|
|
||||||
JSONObject jsonObjectTwo = jeroElasticsearchTemplate.buildBoolQuery(null, null, queryMapJsonTwo);
|
|
||||||
queryMapJsonAll.add(jsonObjectTwo);
|
|
||||||
}
|
|
||||||
|
|
||||||
IPage page = getiPage(selectValue, selectValueTwo, queryMapJsonAll, null, pageNo, pageSize, null,searchVO.getCut());
|
IPage page = getiPage(selectValue, selectValueTwo, queryMapJsonAll, null, pageNo, pageSize, null,searchVO.getCut());
|
||||||
|
|
||||||
|
|
||||||
return page;
|
return page;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -543,7 +384,7 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
|||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
//基础添加封装
|
//基础添加封装
|
||||||
if ("paragraphFlag".equals(paragraphFlag)) {
|
if ("paragraphFlag".equals(paragraphFlag)) {
|
||||||
jsonObject = jeroElasticsearchTemplate.buildBoolQuery(queryMapJson, null, should);
|
jsonObject = jeroElasticsearchTemplate.buildBoolQuery(queryMapJson, null, null);
|
||||||
} else {
|
} else {
|
||||||
jsonObject = jeroElasticsearchTemplate.buildBoolQuery(queryMapJson, null, null);
|
jsonObject = jeroElasticsearchTemplate.buildBoolQuery(queryMapJson, null, null);
|
||||||
}
|
}
|
||||||
@@ -555,7 +396,6 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
|||||||
null,
|
null,
|
||||||
pageNo-1,
|
pageNo-1,
|
||||||
pageSize);
|
pageSize);
|
||||||
// JSONObject queryObject11 = jeroElasticsearchTemplate.buildQuery(null, jsonObject11,highlightMap,null, Integer.parseInt(map.get("pageNo").toString()), Integer.parseInt(map.get("pageSize").toString()));
|
|
||||||
//2. 数据查询
|
//2. 数据查询
|
||||||
JSONObject search = new JSONObject();
|
JSONObject search = new JSONObject();
|
||||||
if(CutEnum.CN.getValue().equals(cut)){
|
if(CutEnum.CN.getValue().equals(cut)){
|
||||||
@@ -575,11 +415,6 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
|||||||
//二次搜索结果
|
//二次搜索结果
|
||||||
List<Map<String, Object>> mapListTwo = new ArrayList<>();
|
List<Map<String, Object>> mapListTwo = new ArrayList<>();
|
||||||
|
|
||||||
// //如果勾选了列表数据,则先通过ids过滤一遍数据
|
|
||||||
// if (list.size() != 0 && StringUtils.isNotBlank(searchVO.getIds())) {
|
|
||||||
// list = list.stream().filter(e -> searchVO.getIds().contains((String) e.get("id"))).collect(Collectors.toList());
|
|
||||||
// }
|
|
||||||
|
|
||||||
List<Map<String, Object>> listNew = new ArrayList<>();
|
List<Map<String, Object>> listNew = new ArrayList<>();
|
||||||
for (Map<String, Object> stringObjectMap : list) {
|
for (Map<String, Object> stringObjectMap : list) {
|
||||||
Map<String, Object> mapSource = (Map<String, Object>) stringObjectMap.get("_source");
|
Map<String, Object> mapSource = (Map<String, Object>) stringObjectMap.get("_source");
|
||||||
@@ -675,11 +510,9 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//处理分页
|
//处理分页
|
||||||
IPage page = new Page(pageNo, pageSize);
|
IPage page = new Page(pageNo, pageSize);
|
||||||
if (StringUtils.isNotBlank(selectValueTwo)) {
|
if (StringUtils.isNotBlank(selectValueTwo)) {
|
||||||
@@ -782,7 +615,6 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
|||||||
}else{
|
}else{
|
||||||
flagTemp = jeroElasticsearchTemplate.indexExists(SearchEnum.FULL_TEXT_SEARCH_EN.getValue());
|
flagTemp = jeroElasticsearchTemplate.indexExists(SearchEnum.FULL_TEXT_SEARCH_EN.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!flagTemp) {
|
if (!flagTemp) {
|
||||||
return new Page(Integer.parseInt(map.get("pageNo").toString()), Integer.parseInt(map.get("pageSize").toString()));
|
return new Page(Integer.parseInt(map.get("pageNo").toString()), Integer.parseInt(map.get("pageSize").toString()));
|
||||||
}
|
}
|
||||||
@@ -795,40 +627,73 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
List<String> inputFieldList = inputOnlCgformFieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
|
List<String> inputFieldList = inputOnlCgformFieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
|
||||||
inputFieldList.add("file_text");//在输入框的类型中添加正文字段
|
inputFieldList.add("file_text");//在输入框的类型中添加正文字段
|
||||||
//下拉,树形,日期等字段
|
|
||||||
List<OnlCgformField> otherOnlCgformFieldList = fieldList.stream()
|
|
||||||
.filter(e -> FieldTypeEnum.PULL_SINGLE.getValue().equals(e.getFieldShowType())//下拉单选
|
|
||||||
|| FieldTypeEnum.PULL_MORE.getValue().equals(e.getFieldShowType())//下拉多选
|
|
||||||
|| FieldTypeEnum.DATE_SINGLE.getValue().equals(e.getFieldShowType())//日期单选
|
|
||||||
|| FieldTypeEnum.DATE_MORE.getValue().equals(e.getFieldShowType())//日期多选
|
|
||||||
|| FieldTypeEnum.TREE.getValue().equals(e.getFieldShowType()))//树形
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
List<String> otherFieldList = otherOnlCgformFieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
|
|
||||||
|
|
||||||
|
|
||||||
Map<String, Object> mapOne = (Map<String, Object>) map.get("mapOne");
|
Map<String, Object> mapOne = (Map<String, Object>) map.get("mapOne");
|
||||||
Map<String, Object> mapTwo = (Map<String, Object>) map.get("mapTwo");
|
Map<String, Object> mapTwo = (Map<String, Object>) map.get("mapTwo");
|
||||||
JSONArray must = new JSONArray();
|
|
||||||
//处理首次查询条件
|
JSONArray queryMapJson = new JSONArray();
|
||||||
|
JSONArray queryMapJsonTwo = new JSONArray();
|
||||||
|
JSONArray queryMapJsonThree = new JSONArray();
|
||||||
|
JSONArray queryMapJsonAll = new JSONArray();
|
||||||
|
//首次查询条件
|
||||||
if (ObjectUtils.isNotEmpty(mapOne)) {
|
if (ObjectUtils.isNotEmpty(mapOne)) {
|
||||||
queryCondition(mapOne, inputFieldList, otherFieldList, must);
|
for (Map.Entry<String, Object> entry : mapOne.entrySet()) {
|
||||||
|
String key = entry.getKey();
|
||||||
|
String value = (String) entry.getValue();
|
||||||
|
if (ObjectUtils.isNotEmpty(value)) {
|
||||||
|
for (String s : value.split(",")) {
|
||||||
|
Map<String, Object> queryMap = new HashMap<>();
|
||||||
|
Map<String, Object> queryMapTemp = new HashMap<>();
|
||||||
|
queryMapTemp.put(key, s);
|
||||||
|
queryMap.put("match_phrase", queryMapTemp);
|
||||||
|
queryMapJson.add(queryMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(CollectionUtils.isNotEmpty(queryMapJson)){
|
||||||
|
JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(null, null, queryMapJson);
|
||||||
|
queryMapJsonAll.add(jsonObject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//处理二次查询条件
|
|
||||||
if (ObjectUtils.isNotEmpty(mapTwo)) {
|
|
||||||
queryCondition(mapTwo, inputFieldList, otherFieldList, must);
|
|
||||||
}
|
|
||||||
//处理ids
|
|
||||||
JSONArray should = new JSONArray();
|
|
||||||
String ids = (String) mapTwo.get("ids");
|
String ids = (String) mapTwo.get("ids");
|
||||||
|
//二次查询条件
|
||||||
|
if (ObjectUtils.isNotEmpty(mapTwo)) {
|
||||||
|
mapTwo.remove("ids");
|
||||||
|
for (Map.Entry<String, Object> entry : mapTwo.entrySet()) {
|
||||||
|
String key = entry.getKey();
|
||||||
|
String value = (String) entry.getValue();
|
||||||
|
if (ObjectUtils.isNotEmpty(value)) {
|
||||||
|
for (String s : value.split(",")) {
|
||||||
|
Map<String, Object> queryMap = new HashMap<>();
|
||||||
|
Map<String, Object> queryMapTemp = new HashMap<>();
|
||||||
|
queryMapTemp.put(key, s);
|
||||||
|
queryMap.put("match_phrase", queryMapTemp);
|
||||||
|
queryMapJsonTwo.add(queryMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(CollectionUtils.isNotEmpty(queryMapJsonTwo)){
|
||||||
|
JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(null, null, queryMapJsonTwo);
|
||||||
|
queryMapJsonAll.add(jsonObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//ids查询条件
|
||||||
if (StringUtils.isNotBlank(ids)) {
|
if (StringUtils.isNotBlank(ids)) {
|
||||||
for (String s : ids.split(",")) {
|
for (String s : ids.split(",")) {
|
||||||
Map<String, Object> queryMap = new HashMap<>();
|
Map<String, Object> queryMap = new HashMap<>();
|
||||||
Map<String, Object> queryMapTemp = new HashMap<>();
|
Map<String, Object> queryMapTemp = new HashMap<>();
|
||||||
queryMapTemp.put("id", s);
|
queryMapTemp.put("id", s);
|
||||||
queryMap.put("match_phrase", queryMapTemp);
|
queryMap.put("match_phrase", queryMapTemp);
|
||||||
should.add(queryMap);
|
queryMapJsonThree.add(queryMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(CollectionUtils.isNotEmpty(queryMapJsonThree)){
|
||||||
|
JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(null, null, queryMapJsonThree);
|
||||||
|
queryMapJsonAll.add(jsonObject);
|
||||||
|
}
|
||||||
|
|
||||||
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());
|
||||||
@@ -853,7 +718,7 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
|||||||
String paragraphFlag = "paragraphFlag";
|
String paragraphFlag = "paragraphFlag";
|
||||||
|
|
||||||
|
|
||||||
IPage iPage = getiPage(selectValue, selectValueTwo, must, should, pageNo, pageSize, paragraphFlag,(String) map.get("cut"));
|
IPage iPage = getiPage(selectValue, selectValueTwo, queryMapJsonAll, null, pageNo, pageSize, paragraphFlag,(String) map.get("cut"));
|
||||||
return iPage;
|
return iPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user