提交 bcf047de 作者: obcy

【每个标签之间改为与的关系】

上级 590f7d87
...@@ -2386,17 +2386,17 @@ public class EsService { ...@@ -2386,17 +2386,17 @@ public class EsService {
if (CollectionUtils.isNotEmpty(searchCondition.getSpecialLabelParams())) { if (CollectionUtils.isNotEmpty(searchCondition.getSpecialLabelParams())) {
cn.hutool.json.JSONObject params = searchCondition.getSpecialLabelParams(); cn.hutool.json.JSONObject params = searchCondition.getSpecialLabelParams();
String entityObjectId = params.getStr("entityObjectId"); String entityObjectId = params.getStr("entityObjectId");
BoolQueryBuilder specialLabelQuery = QueryBuilders.boolQuery();
if (StrUtil.isNotBlank(entityObjectId) && ("1892197364882550786".equals(entityObjectId) || "1874728877847257089".equals(entityObjectId))){ if (StrUtil.isNotBlank(entityObjectId) && ("1892197364882550786".equals(entityObjectId) || "1874728877847257089".equals(entityObjectId))){
cn.hutool.json.JSONArray jsonArray = params.getJSONArray("labelCodeList"); cn.hutool.json.JSONArray jsonArray = params.getJSONArray("labelCodeList");
if (ObjectUtil.isNotEmpty(jsonArray) && !jsonArray.isEmpty()){ if (ObjectUtil.isNotEmpty(jsonArray) && !jsonArray.isEmpty()){
List<String> reids = new ArrayList<>();
jsonArray.forEach(e -> { jsonArray.forEach(e -> {
cn.hutool.json.JSONObject jsonObject = (cn.hutool.json.JSONObject) e; cn.hutool.json.JSONObject jsonObject = (cn.hutool.json.JSONObject) e;
String labelCode = jsonObject.getStr("labelCode"); String labelCode = jsonObject.getStr("labelCode");
if (StrUtil.isNotBlank(labelCode)){ if (StrUtil.isNotBlank(labelCode)){
cn.hutool.json.JSONArray jsonArray1 = jsonObject.getJSONArray("children"); cn.hutool.json.JSONArray jsonArray1 = jsonObject.getJSONArray("children");
if (jsonArray1 != null && !jsonArray1.isEmpty()){ if (jsonArray1 != null && !jsonArray1.isEmpty()){
List<String> reids = new ArrayList<>();
jsonArray1.forEach(f -> { jsonArray1.forEach(f -> {
cn.hutool.json.JSONObject jsonObject1 = (cn.hutool.json.JSONObject) f; cn.hutool.json.JSONObject jsonObject1 = (cn.hutool.json.JSONObject) f;
String labelItemCode = jsonObject1.getStr("labelItemCode"); String labelItemCode = jsonObject1.getStr("labelItemCode");
...@@ -2404,13 +2404,14 @@ public class EsService { ...@@ -2404,13 +2404,14 @@ public class EsService {
reids.add(labelCode+"-"+labelItemCode); reids.add(labelCode+"-"+labelItemCode);
} }
}); });
if (CollectionUtils.isNotEmpty(reids)){
BoolQueryBuilder specialLabelQuery = QueryBuilders.boolQuery();
specialLabelQuery.must(QueryBuilders.nestedQuery("labels",QueryBuilders.termsQuery("labels.relationId",reids),ScoreMode.None));
boolQuery.must(specialLabelQuery);
}
} }
} }
}); });
if (CollectionUtils.isNotEmpty(reids)){
specialLabelQuery.must(QueryBuilders.nestedQuery("labels",QueryBuilders.termsQuery("labels.relationId",reids),ScoreMode.None));
boolQuery.must(specialLabelQuery);
}
} }
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论