Search in sources :

Example 16 with SimpleFieldFilterScope

use of org.sonar.server.es.searchrequest.TopAggregationDefinition.SimpleFieldFilterScope in project sonarqube by SonarSource.

the class IssueIndex method addCreatedAfterByProjectsFilter.

private static void addCreatedAfterByProjectsFilter(AllFilters allFilters, IssueQuery query) {
    Map<String, PeriodStart> createdAfterByProjectUuids = query.createdAfterByProjectUuids();
    BoolQueryBuilder boolQueryBuilder = boolQuery();
    createdAfterByProjectUuids.forEach((projectOrProjectBranchUuid, createdAfterDate) -> boolQueryBuilder.should(boolQuery().filter(termQuery(FIELD_ISSUE_BRANCH_UUID, projectOrProjectBranchUuid)).filter(rangeQuery(FIELD_ISSUE_FUNC_CREATED_AT).from(BaseDoc.dateToEpochSeconds(createdAfterDate.date()), createdAfterDate.inclusive()))));
    allFilters.addFilter("__created_after_by_project_uuids", new SimpleFieldFilterScope("createdAfterByProjectUuids"), boolQueryBuilder);
}
Also used : SimpleFieldFilterScope(org.sonar.server.es.searchrequest.TopAggregationDefinition.SimpleFieldFilterScope) BoolQueryBuilder(org.elasticsearch.index.query.BoolQueryBuilder) PeriodStart(org.sonar.server.issue.index.IssueQuery.PeriodStart)

Aggregations

SimpleFieldFilterScope (org.sonar.server.es.searchrequest.TopAggregationDefinition.SimpleFieldFilterScope)16 Test (org.junit.Test)10 BoolQueryBuilder (org.elasticsearch.index.query.BoolQueryBuilder)7 AllFilters (org.sonar.server.es.searchrequest.RequestFiltersComputer.AllFilters)6 NestedFieldFilterScope (org.sonar.server.es.searchrequest.TopAggregationDefinition.NestedFieldFilterScope)5 QueryBuilder (org.elasticsearch.index.query.QueryBuilder)4 RequestFiltersComputer.newAllFilters (org.sonar.server.es.searchrequest.RequestFiltersComputer.newAllFilters)4 PeriodStart (org.sonar.server.issue.index.IssueQuery.PeriodStart)1 MetricCriterion (org.sonar.server.measure.index.ProjectMeasuresQuery.MetricCriterion)1