搜索段落修改
This commit is contained in:
+29
-3
@@ -849,11 +849,20 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
|||||||
Map<String, Object> mapTwo = (Map<String, Object>) map.get("mapTwo");
|
Map<String, Object> mapTwo = (Map<String, Object>) map.get("mapTwo");
|
||||||
|
|
||||||
JSONArray queryMapJson = new JSONArray();
|
JSONArray queryMapJson = new JSONArray();
|
||||||
|
JSONArray queryMapJsonTemp = new JSONArray();
|
||||||
JSONArray queryMapJsonTwo = new JSONArray();
|
JSONArray queryMapJsonTwo = new JSONArray();
|
||||||
JSONArray queryMapJsonThree = new JSONArray();
|
JSONArray queryMapJsonThree = new JSONArray();
|
||||||
JSONArray queryMapJsonAll = new JSONArray();
|
JSONArray queryMapJsonAll = new JSONArray();
|
||||||
//首次查询条件
|
//首次查询条件
|
||||||
if (ObjectUtils.isNotEmpty(mapOne)) {
|
if (ObjectUtils.isNotEmpty(mapOne)) {
|
||||||
|
if(StringUtils.isNotBlank((String)mapOne.get("title"))
|
||||||
|
|| StringUtils.isNotBlank((String)mapOne.get("serial_number"))){
|
||||||
|
Map<String, Object> queryMap = new HashMap<>();
|
||||||
|
Map<String, Object> queryMapTemp = new HashMap<>();
|
||||||
|
queryMapTemp.put("flag",SEARCH_FLAG );
|
||||||
|
queryMap.put("match_phrase", queryMapTemp);
|
||||||
|
queryMapJsonTemp.add(queryMap);
|
||||||
|
}
|
||||||
for (Map.Entry<String, Object> entry : mapOne.entrySet()) {
|
for (Map.Entry<String, Object> entry : mapOne.entrySet()) {
|
||||||
String key = entry.getKey();
|
String key = entry.getKey();
|
||||||
String value = (String) entry.getValue();
|
String value = (String) entry.getValue();
|
||||||
@@ -867,10 +876,27 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(CollectionUtils.isNotEmpty(queryMapJson)){
|
if(CollectionUtils.isNotEmpty(queryMapJsonTemp)){
|
||||||
JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(null, null, queryMapJson);
|
JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(queryMapJsonTemp, null, null);
|
||||||
queryMapJsonAll.add(jsonObject);
|
queryMapJsonAll.add(jsonObject);
|
||||||
}
|
}
|
||||||
|
if(CollectionUtils.isNotEmpty(queryMapJson)){
|
||||||
|
JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(queryMapJson, null, null);
|
||||||
|
queryMapJsonAll.add(jsonObject);
|
||||||
|
}
|
||||||
|
//首次查询所有的条件是and的关系
|
||||||
|
// if(ObjectUtils.isEmpty(mapTwo)){
|
||||||
|
// if(CollectionUtils.isNotEmpty(queryMapJson)){
|
||||||
|
// JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(queryMapJson, null, null);
|
||||||
|
// queryMapJsonAll.add(jsonObject);
|
||||||
|
// }
|
||||||
|
// }else{
|
||||||
|
// if(CollectionUtils.isNotEmpty(queryMapJson)){
|
||||||
|
// JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(null, null, queryMapJson);
|
||||||
|
// queryMapJsonAll.add(jsonObject);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String ids = (String) mapTwo.get("ids");
|
String ids = (String) mapTwo.get("ids");
|
||||||
@@ -891,7 +917,7 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(CollectionUtils.isNotEmpty(queryMapJsonTwo)){
|
if(CollectionUtils.isNotEmpty(queryMapJsonTwo)){
|
||||||
JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(null, null, queryMapJsonTwo);
|
JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(queryMapJsonTwo, null, null);
|
||||||
queryMapJsonAll.add(jsonObject);
|
queryMapJsonAll.add(jsonObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user