搜索中心-文档库-标准体系(下拉多选)

This commit is contained in:
zhn
2023-12-20 14:06:40 +08:00
parent f9e2193a06
commit f40a880141
@@ -197,7 +197,7 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
Map<String, Object> mapTwo = (Map<String, Object>) map.get("mapTwo");
JSONArray must = new JSONArray();
//处理首次查询条件
if (ObjectUtils.isNotEmpty(mapOne)) {
if (ObjectUtils.isNotEmpty(mapOne)) {
queryCondition(mapOne, inputFieldList, otherFieldList,dateFieldList, must);
}
//处理二次查询条件
@@ -423,27 +423,44 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
for (Map.Entry<String, Object> entry : otherMap.entrySet()) {
String key = entry.getKey();
String value = (String) entry.getValue();
if("technology_territory".equals(key) && ObjectUtils.isNotEmpty(value)){
JSONArray should = new JSONArray();
if(StringUtils.isNotBlank(value)){
if("technology_territory".equals(key) && ObjectUtils.isNotEmpty(value)){
JSONArray should = new JSONArray();
List<Map<String,Object>> mapList = new ArrayList<>();
for (String s : value.split(",")) {
Map<String,Object> map = new HashMap();
map.put(key,"*"+s+"*");
Map<String,Object> map1 = new HashMap<>();
map1.put("wildcard",map);
should.add(map1);
List<Map<String,Object>> mapList = new ArrayList<>();
for (String s : value.split(",")) {
Map<String,Object> map = new HashMap();
map.put(key,"*"+s+"*");
Map<String,Object> map1 = new HashMap<>();
map1.put("wildcard",map);
should.add(map1);
}
JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(null, null, should);
must.add(jsonObject);
}else if("standard_system".equals(key) && ObjectUtils.isNotEmpty(value)){
JSONArray should = new JSONArray();
List<Map<String,Object>> mapList = new ArrayList<>();
for (String s : value.split(",")) {
Map<String,Object> map = new HashMap();
map.put("query",s);
Map<String,Object> map1 = new HashMap<>();
map1.put(key,map);
Map<String,Object> map2 = new HashMap<>();
map2.put("match",map1);
should.add(map2);
}
JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(null, null, should);
must.add(jsonObject);
}else{
Map<String, Object> map = new HashMap<>();
Map<String, Object> queryMap = new HashMap<>();
Map<String, Object> queryMapTemp = new HashMap<>();
queryMapTemp.put("query", value);
queryMap.put(key, queryMapTemp);
map.put("match",queryMap);
must.add(map);
}
JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(null, null, should);
must.add(jsonObject);
}else{
Map<String, Object> map = new HashMap<>();
Map<String, Object> queryMap = new HashMap<>();
Map<String, Object> queryMapTemp = new HashMap<>();
queryMapTemp.put("query", value);
queryMap.put(key, queryMapTemp);
map.put("match",queryMap);
must.add(map);
}
}
}