提交 f3a3f15d 作者: obcy

Merge remote-tracking branch 'origin/event_fusion' into event_fusion

...@@ -17,10 +17,7 @@ import org.elasticsearch.action.search.SearchRequest; ...@@ -17,10 +17,7 @@ import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.*;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.query.TermQueryBuilder;
import org.elasticsearch.index.query.TermsQueryBuilder;
import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.search.sort.SortOrder; import org.elasticsearch.search.sort.SortOrder;
...@@ -257,6 +254,18 @@ public class ReportDataController { ...@@ -257,6 +254,18 @@ public class ReportDataController {
} else { } else {
boolQuery.filter(QueryBuilders.rangeQuery("publishDate").lte(EsDateUtil.esFieldDateFormat(DateUtil.dateToString(new Date())))); boolQuery.filter(QueryBuilders.rangeQuery("publishDate").lte(EsDateUtil.esFieldDateFormat(DateUtil.dateToString(new Date()))));
} }
//组合标签查询(不同类标签之间是与的关系,同一类标签之间是或的关系),示例: "a1,a2;c1,c2;e1,e2"
String composeSearchLabelIds = searchCondition.getComposeSearchLabelIds();
if (StringUtils.isNotEmpty(composeSearchLabelIds)) {
//分号隔开的标签查询用且的关系
String[] split = composeSearchLabelIds.split(";");
for (String items : split) {
List<String> ids = Arrays.asList(items.split(","));
NestedQueryBuilder nestedQueryBuilder = QueryBuilders
.nestedQuery("labels", QueryBuilders.termsQuery("labels.relationId",ids), ScoreMode.None);
boolQuery.must(nestedQueryBuilder);
}
}
//关联标签id集合 //关联标签id集合
List<String> labelIds = searchCondition.getLabelIds(); List<String> labelIds = searchCondition.getLabelIds();
if (CollectionUtils.isNotEmpty(labelIds)) { if (CollectionUtils.isNotEmpty(labelIds)) {
......
...@@ -55,6 +55,10 @@ public class SearchCondition { ...@@ -55,6 +55,10 @@ public class SearchCondition {
@FieldDescription(value = "爬虫类型") @FieldDescription(value = "爬虫类型")
private String crawler; private String crawler;
//组合标签查询(不同类标签之间是与的关系,同一类标签之间是或的关系),示例: "a,b;c,d;e,f"
@FieldDescription(value = "组合标签查询")
private String composeSearchLabelIds;
/**----企业类标签筛选----**/ /**----企业类标签筛选----**/
//企业类标签id集合 //企业类标签id集合
@FieldDescription(value = "企业类标签id集合") @FieldDescription(value = "企业类标签id集合")
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论