Search in sources :

Example 1 with RequestFiltersComputer

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

the class ProjectMeasuresIndex method search.

public SearchIdResult<String> search(ProjectMeasuresQuery query, SearchOptions searchOptions) {
    SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder().fetchSource(false).trackTotalHits(true).from(searchOptions.getOffset()).size(searchOptions.getLimit());
    AllFilters allFilters = createFilters(query);
    RequestFiltersComputer filtersComputer = createFiltersComputer(searchOptions, allFilters);
    addFacets(searchSourceBuilder, searchOptions, filtersComputer, query);
    addSort(query, searchSourceBuilder);
    filtersComputer.getQueryFilters().ifPresent(searchSourceBuilder::query);
    filtersComputer.getPostFilters().ifPresent(searchSourceBuilder::postFilter);
    SearchResponse response = client.search(EsClient.prepareSearch(TYPE_PROJECT_MEASURES.getMainType()).source(searchSourceBuilder));
    return new SearchIdResult<>(response, id -> id, system2.getDefaultTimeZone().toZoneId());
}
Also used : AllFilters(org.sonar.server.es.searchrequest.RequestFiltersComputer.AllFilters) RequestFiltersComputer(org.sonar.server.es.searchrequest.RequestFiltersComputer) SearchIdResult(org.sonar.server.es.SearchIdResult) SearchSourceBuilder(org.elasticsearch.search.builder.SearchSourceBuilder) SearchResponse(org.elasticsearch.action.search.SearchResponse)

Example 2 with RequestFiltersComputer

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

the class ProjectMeasuresIndex method addFacets.

private static void addFacets(SearchSourceBuilder esRequest, SearchOptions options, RequestFiltersComputer filtersComputer, ProjectMeasuresQuery query) {
    TopAggregationHelper topAggregationHelper = new TopAggregationHelper(filtersComputer, new SubAggregationHelper());
    options.getFacets().stream().map(FACETS_BY_NAME::get).filter(Objects::nonNull).map(facet -> facet.getFacetBuilder().buildFacet(facet, query, topAggregationHelper)).forEach(esRequest::aggregation);
}
Also used : ArrayListMultimap(com.google.common.collect.ArrayListMultimap) Arrays(java.util.Arrays) SECURITY_HOTSPOTS_REVIEWED_KEY(org.sonar.api.measures.CoreMetrics.SECURITY_HOTSPOTS_REVIEWED_KEY) RangeAggregationBuilder(org.elasticsearch.search.aggregations.bucket.range.RangeAggregationBuilder) EsClient(org.sonar.server.es.EsClient) DESC(org.elasticsearch.search.sort.SortOrder.DESC) SimpleFieldFilterScope(org.sonar.server.es.searchrequest.TopAggregationDefinition.SimpleFieldFilterScope) SimpleFieldTopAggregationDefinition(org.sonar.server.es.searchrequest.SimpleFieldTopAggregationDefinition) Bucket(org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation.Bucket) Map(java.util.Map) BucketOrder(org.elasticsearch.search.aggregations.BucketOrder) FIELD_LANGUAGES(org.sonar.server.measure.index.ProjectMeasuresIndexDefinition.FIELD_LANGUAGES) FILTER_LANGUAGES(org.sonarqube.ws.client.project.ProjectsWsParameters.FILTER_LANGUAGES) RELIABILITY_RATING_KEY(org.sonar.api.measures.CoreMetrics.RELIABILITY_RATING_KEY) NEW_COVERAGE_KEY(org.sonar.api.measures.CoreMetrics.NEW_COVERAGE_KEY) FIELD_QUALITY_GATE_STATUS(org.sonar.server.measure.index.ProjectMeasuresIndexDefinition.FIELD_QUALITY_GATE_STATUS) SUB_FIELD_MEASURES_KEY(org.sonar.server.measure.index.ProjectMeasuresIndexDefinition.SUB_FIELD_MEASURES_KEY) FIELD_MEASURES_MEASURE_VALUE(org.sonar.server.measure.index.ProjectMeasuresIndexDefinition.FIELD_MEASURES_MEASURE_VALUE) QueryBuilders.boolQuery(org.elasticsearch.index.query.QueryBuilders.boolQuery) FIELD_NCLOC_DISTRIBUTION_LANGUAGE(org.sonar.server.measure.index.ProjectMeasuresIndexDefinition.FIELD_NCLOC_DISTRIBUTION_LANGUAGE) SORT_BY_NAME(org.sonar.server.measure.index.ProjectMeasuresQuery.SORT_BY_NAME) Set(java.util.Set) NEW_DUPLICATED_LINES_DENSITY_KEY(org.sonar.api.measures.CoreMetrics.NEW_DUPLICATED_LINES_DENSITY_KEY) FIELD_MEASURES_MEASURE_KEY(org.sonar.server.measure.index.ProjectMeasuresIndexDefinition.FIELD_MEASURES_MEASURE_KEY) FieldSortBuilder(org.elasticsearch.search.sort.FieldSortBuilder) ScoreMode(org.apache.lucene.search.join.ScoreMode) Sum(org.elasticsearch.search.aggregations.metrics.Sum) MAX_PAGE_SIZE(org.sonarqube.ws.client.project.ProjectsWsParameters.MAX_PAGE_SIZE) NEW_RELIABILITY_RATING_KEY(org.sonar.api.measures.CoreMetrics.NEW_RELIABILITY_RATING_KEY) ALERT_STATUS_KEY(org.sonar.api.measures.CoreMetrics.ALERT_STATUS_KEY) Stream(java.util.stream.Stream) NestedFieldTopAggregationDefinition(org.sonar.server.es.searchrequest.NestedFieldTopAggregationDefinition) QueryBuilders.rangeQuery(org.elasticsearch.index.query.QueryBuilders.rangeQuery) EsUtils.termsToMap(org.sonar.server.es.EsUtils.termsToMap) AggregationBuilders.sum(org.elasticsearch.search.aggregations.AggregationBuilders.sum) AggregationBuilders.filters(org.elasticsearch.search.aggregations.AggregationBuilders.filters) ALERT_STATUS(org.sonar.server.measure.index.ProjectMeasuresIndex.Facet.ALERT_STATUS) WebAuthorizationTypeSupport(org.sonar.server.permission.index.WebAuthorizationTypeSupport) SearchSourceBuilder(org.elasticsearch.search.builder.SearchSourceBuilder) STICKY(org.sonar.server.es.searchrequest.TopAggregationDefinition.STICKY) FIELD_INDEX_TYPE(org.sonar.server.es.IndexType.FIELD_INDEX_TYPE) TermsAggregationBuilder(org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder) Nullable(javax.annotation.Nullable) QueryBuilder(org.elasticsearch.index.query.QueryBuilder) SECURITY_RATING_KEY(org.sonar.api.measures.CoreMetrics.SECURITY_RATING_KEY) NEW_LINES_KEY(org.sonar.api.measures.CoreMetrics.NEW_LINES_KEY) FIELD_KEY(org.sonar.server.measure.index.ProjectMeasuresIndexDefinition.FIELD_KEY) RequestFiltersComputer(org.sonar.server.es.searchrequest.RequestFiltersComputer) FIELD_NAME(org.sonar.server.measure.index.ProjectMeasuresIndexDefinition.FIELD_NAME) MetricCriterion(org.sonar.server.measure.index.ProjectMeasuresQuery.MetricCriterion) QUALITY_GATE_STATUS(org.sonar.server.measure.index.ProjectMeasuresDoc.QUALITY_GATE_STATUS) TotalHits(org.apache.lucene.search.TotalHits) QueryBuilders.termQuery(org.elasticsearch.index.query.QueryBuilders.termQuery) COVERAGE_KEY(org.sonar.api.measures.CoreMetrics.COVERAGE_KEY) Qualifiers(org.sonar.api.resources.Qualifiers) NCLOC_KEY(org.sonar.api.measures.CoreMetrics.NCLOC_KEY) FILTER_TAGS(org.sonarqube.ws.client.project.ProjectsWsParameters.FILTER_TAGS) KeyedFilter(org.elasticsearch.search.aggregations.bucket.filter.FiltersAggregator.KeyedFilter) NestedFieldFilterScope(org.sonar.server.es.searchrequest.TopAggregationDefinition.NestedFieldFilterScope) QueryBuilders.nestedQuery(org.elasticsearch.index.query.QueryBuilders.nestedQuery) NEW_SECURITY_RATING_KEY(org.sonar.api.measures.CoreMetrics.NEW_SECURITY_RATING_KEY) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) SORT_BY_LAST_ANALYSIS_DATE(org.sonar.server.measure.index.ProjectMeasuresQuery.SORT_BY_LAST_ANALYSIS_DATE) SearchResponse(org.elasticsearch.action.search.SearchResponse) NEW_MAINTAINABILITY_RATING_KEY(org.sonar.api.measures.CoreMetrics.NEW_MAINTAINABILITY_RATING_KEY) TAGS(org.sonar.server.measure.index.ProjectMeasuresIndex.Facet.TAGS) FIELD_ANALYSED_AT(org.sonar.server.measure.index.ProjectMeasuresIndexDefinition.FIELD_ANALYSED_AT) DefaultIndexSettingsElement(org.sonar.server.es.newindex.DefaultIndexSettingsElement) SubAggregationHelper(org.sonar.server.es.searchrequest.SubAggregationHelper) TYPE_PROJECT_MEASURES(org.sonar.server.measure.index.ProjectMeasuresIndexDefinition.TYPE_PROJECT_MEASURES) System2(org.sonar.api.utils.System2) SearchIdResult(org.sonar.server.es.SearchIdResult) Terms(org.elasticsearch.search.aggregations.bucket.terms.Terms) Collections.emptyList(java.util.Collections.emptyList) Collection(java.util.Collection) NestedSortBuilder(org.elasticsearch.search.sort.NestedSortBuilder) TopAggregationDefinition(org.sonar.server.es.searchrequest.TopAggregationDefinition) FilterAggregationBuilder(org.elasticsearch.search.aggregations.bucket.filter.FilterAggregationBuilder) FILTER_QUALIFIER(org.sonarqube.ws.client.project.ProjectsWsParameters.FILTER_QUALIFIER) Objects(java.util.Objects) TopAggregationHelper(org.sonar.server.es.searchrequest.TopAggregationHelper) List(java.util.List) SearchOptions(org.sonar.server.es.SearchOptions) SQALE_RATING_KEY(org.sonar.api.measures.CoreMetrics.SQALE_RATING_KEY) ServerSide(org.sonar.api.server.ServerSide) AllFilters(org.sonar.server.es.searchrequest.RequestFiltersComputer.AllFilters) MoreCollectors.uniqueIndex(org.sonar.core.util.stream.MoreCollectors.uniqueIndex) BoolQueryBuilder(org.elasticsearch.index.query.BoolQueryBuilder) IntStream(java.util.stream.IntStream) IncludeExclude(org.elasticsearch.search.aggregations.bucket.terms.IncludeExclude) FIELD_NCLOC_DISTRIBUTION(org.sonar.server.measure.index.ProjectMeasuresIndexDefinition.FIELD_NCLOC_DISTRIBUTION) AbstractAggregationBuilder(org.elasticsearch.search.aggregations.AbstractAggregationBuilder) EsUtils.escapeSpecialRegexChars(org.sonar.server.es.EsUtils.escapeSpecialRegexChars) Multimap(com.google.common.collect.Multimap) FIELD_NCLOC_DISTRIBUTION_NCLOC(org.sonar.server.measure.index.ProjectMeasuresIndexDefinition.FIELD_NCLOC_DISTRIBUTION_NCLOC) Function(java.util.function.Function) NEW_SECURITY_REVIEW_RATING_KEY(org.sonar.api.measures.CoreMetrics.NEW_SECURITY_REVIEW_RATING_KEY) MoreCollectors.toSet(org.sonar.core.util.stream.MoreCollectors.toSet) Nested(org.elasticsearch.search.aggregations.bucket.nested.Nested) SECURITY_REVIEW_RATING_KEY(org.sonar.api.measures.CoreMetrics.SECURITY_REVIEW_RATING_KEY) MoreCollectors(org.sonar.core.util.stream.MoreCollectors) QueryBuilders.termsQuery(org.elasticsearch.index.query.QueryBuilders.termsQuery) Optional.ofNullable(java.util.Optional.ofNullable) DUPLICATED_LINES_DENSITY_KEY(org.sonar.api.measures.CoreMetrics.DUPLICATED_LINES_DENSITY_KEY) FIELD_QUALIFIER(org.sonar.server.measure.index.ProjectMeasuresIndexDefinition.FIELD_QUALIFIER) AggregationBuilders(org.elasticsearch.search.aggregations.AggregationBuilders) LANGUAGES(org.sonar.server.measure.index.ProjectMeasuresIndex.Facet.LANGUAGES) Consumer(java.util.function.Consumer) FIELD_MEASURES(org.sonar.server.measure.index.ProjectMeasuresIndexDefinition.FIELD_MEASURES) ASC(org.elasticsearch.search.sort.SortOrder.ASC) NO_EXTRA_FILTER(org.sonar.server.es.searchrequest.TopAggregationHelper.NO_EXTRA_FILTER) FIELD_TAGS(org.sonar.server.measure.index.ProjectMeasuresIndexDefinition.FIELD_TAGS) NEW_SECURITY_HOTSPOTS_REVIEWED_KEY(org.sonar.api.measures.CoreMetrics.NEW_SECURITY_HOTSPOTS_REVIEWED_KEY) Metric(org.sonar.api.measures.Metric) SubAggregationHelper(org.sonar.server.es.searchrequest.SubAggregationHelper) Objects(java.util.Objects) TopAggregationHelper(org.sonar.server.es.searchrequest.TopAggregationHelper)

Example 3 with RequestFiltersComputer

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

the class IssueIndex method search.

public SearchResponse search(IssueQuery query, SearchOptions options) {
    SearchRequest requestBuilder = EsClient.prepareSearch(TYPE_ISSUE.getMainType());
    SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
    requestBuilder.source(sourceBuilder);
    configureSorting(query, sourceBuilder);
    configurePagination(options, sourceBuilder);
    configureRouting(query, options, requestBuilder);
    AllFilters allFilters = createAllFilters(query);
    RequestFiltersComputer filterComputer = newFilterComputer(options, allFilters);
    configureTopAggregations(query, options, sourceBuilder, allFilters, filterComputer);
    configureQuery(sourceBuilder, filterComputer);
    configureTopFilters(sourceBuilder, filterComputer);
    sourceBuilder.fetchSource(false).trackTotalHits(true);
    return client.search(requestBuilder);
}
Also used : SearchRequest(org.elasticsearch.action.search.SearchRequest) AllFilters(org.sonar.server.es.searchrequest.RequestFiltersComputer.AllFilters) RequestFiltersComputer(org.sonar.server.es.searchrequest.RequestFiltersComputer) SearchSourceBuilder(org.elasticsearch.search.builder.SearchSourceBuilder)

Example 4 with RequestFiltersComputer

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

the class IssueIndex method configureQuery.

private static void configureQuery(SearchSourceBuilder esRequest, RequestFiltersComputer filterComputer) {
    QueryBuilder esQuery = filterComputer.getQueryFilters().map(t -> (QueryBuilder) boolQuery().must(matchAllQuery()).filter(t)).orElse(matchAllQuery());
    esRequest.query(esQuery);
}
Also used : Arrays(java.util.Arrays) StringUtils(org.apache.commons.lang.StringUtils) CWE(org.sonar.server.issue.index.IssueIndex.Facet.CWE) SumAggregationBuilder(org.elasticsearch.search.aggregations.metrics.SumAggregationBuilder) PARAM_ASSIGNEES(org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_ASSIGNEES) AUTHOR(org.sonar.server.issue.index.IssueIndex.Facet.AUTHOR) EsClient(org.sonar.server.es.EsClient) Collections.singletonList(java.util.Collections.singletonList) FIELD_ISSUE_KEY(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_KEY) SimpleFieldFilterScope(org.sonar.server.es.searchrequest.TopAggregationDefinition.SimpleFieldFilterScope) SimpleFieldTopAggregationDefinition(org.sonar.server.es.searchrequest.SimpleFieldTopAggregationDefinition) LANGUAGES(org.sonar.server.issue.index.IssueIndex.Facet.LANGUAGES) PARAM_FILES(org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_FILES) Map(java.util.Map) FIELD_ISSUE_FUNC_CREATED_AT(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_FUNC_CREATED_AT) FIELD_ISSUE_TAGS(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_TAGS) FIELD_ISSUE_RULE_UUID(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_RULE_UUID) ParsedFilter(org.elasticsearch.search.aggregations.bucket.filter.ParsedFilter) BucketOrder(org.elasticsearch.search.aggregations.BucketOrder) SEVERITIES(org.sonar.server.issue.index.IssueIndex.Facet.SEVERITIES) FIELD_ISSUE_SCOPE(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_SCOPE) PARAM_SCOPES(org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_SCOPES) PARAM_STATUSES(org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_STATUSES) SANS_TOP_25(org.sonar.server.issue.index.IssueIndex.Facet.SANS_TOP_25) FIELD_ISSUE_CWE(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_CWE) TYPE_ISSUE(org.sonar.server.issue.index.IssueIndexDefinition.TYPE_ISSUE) QueryBuilders.boolQuery(org.elasticsearch.index.query.QueryBuilders.boolQuery) PARAM_TYPES(org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_TYPES) Set(java.util.Set) FieldSortBuilder(org.elasticsearch.search.sort.FieldSortBuilder) FIELD_ISSUE_IS_MAIN_BRANCH(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_IS_MAIN_BRANCH) FIELD_ISSUE_STATUS(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_STATUS) ParsedMax(org.elasticsearch.search.aggregations.metrics.ParsedMax) Stream(java.util.stream.Stream) CREATED_AT(org.sonar.server.issue.index.IssueIndex.Facet.CREATED_AT) Min(org.elasticsearch.search.aggregations.metrics.Min) FILES(org.sonar.server.issue.index.IssueIndex.Facet.FILES) SecurityReviewRating.computePercent(org.sonar.server.security.SecurityReviewRating.computePercent) ViewIndexDefinition(org.sonar.server.view.index.ViewIndexDefinition) FIELD_ISSUE_ASSIGNEE_UUID(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_ASSIGNEE_UUID) FIELD_ISSUE_LINE(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_LINE) PROJECT_UUIDS(org.sonar.server.issue.index.IssueIndex.Facet.PROJECT_UUIDS) TYPE_VIEW(org.sonar.server.view.index.ViewIndexDefinition.TYPE_VIEW) AuthorizationDoc(org.sonar.server.permission.index.AuthorizationDoc) Duration(org.joda.time.Duration) FIELD_ISSUE_BRANCH_UUID(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_BRANCH_UUID) FIELD_ISSUE_TYPE(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_TYPE) QueryBuilders.rangeQuery(org.elasticsearch.index.query.QueryBuilders.rangeQuery) RULES(org.sonar.server.issue.index.IssueIndex.Facet.RULES) SearchRequest(org.elasticsearch.action.search.SearchRequest) STATUSES(org.sonar.server.issue.index.IssueIndex.Facet.STATUSES) ArrayList(java.util.ArrayList) RuleType(org.sonar.api.rules.RuleType) FIELD_ISSUE_VULNERABILITY_PROBABILITY(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_VULNERABILITY_PROBABILITY) PARAM_CREATED_AT(org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_CREATED_AT) OptionalLong(java.util.OptionalLong) FIELD_ISSUE_RESOLUTION(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_RESOLUTION) FIELD_ISSUE_SEVERITY_VALUE(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_SEVERITY_VALUE) Severity(org.sonar.api.rule.Severity) DateUtils(org.sonar.api.utils.DateUtils) WebAuthorizationTypeSupport(org.sonar.server.permission.index.WebAuthorizationTypeSupport) SearchSourceBuilder(org.elasticsearch.search.builder.SearchSourceBuilder) STICKY(org.sonar.server.es.searchrequest.TopAggregationDefinition.STICKY) FIELD_INDEX_TYPE(org.sonar.server.es.IndexType.FIELD_INDEX_TYPE) TermsAggregationBuilder(org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder) Nullable(javax.annotation.Nullable) FIELD_ISSUE_NEW_CODE_REFERENCE(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_NEW_CODE_REFERENCE) PARAM_DIRECTORIES(org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_DIRECTORIES) PARAM_RESOLUTIONS(org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_RESOLUTIONS) QueryBuilder(org.elasticsearch.index.query.QueryBuilder) PARAM_SEVERITIES(org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_SEVERITIES) QueryBuilders.matchAllQuery(org.elasticsearch.index.query.QueryBuilders.matchAllQuery) RequestFiltersComputer(org.sonar.server.es.searchrequest.RequestFiltersComputer) NON_STICKY(org.sonar.server.es.searchrequest.TopAggregationDefinition.NON_STICKY) NO_OTHER_SUBAGGREGATION(org.sonar.server.es.searchrequest.TopAggregationHelper.NO_OTHER_SUBAGGREGATION) PARAM_LANGUAGES(org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_LANGUAGES) ASSIGNED_TO_ME(org.sonar.server.issue.index.IssueIndex.Facet.ASSIGNED_TO_ME) FIELD_ISSUE_OWASP_TOP_10(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_OWASP_TOP_10) HasAggregations(org.elasticsearch.search.aggregations.HasAggregations) SANS_TOP_25_RISKY_RESOURCE(org.sonar.server.security.SecurityStandards.SANS_TOP_25_RISKY_RESOURCE) QueryBuilders.termQuery(org.elasticsearch.index.query.QueryBuilders.termQuery) PARAM_OWASP_TOP_10(org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_OWASP_TOP_10) FIELD_ISSUE_FILE_PATH(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_FILE_PATH) Preconditions(com.google.common.base.Preconditions) FIELD_ISSUE_FUNC_CLOSED_AT(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_FUNC_CLOSED_AT) SecurityStandards(org.sonar.server.security.SecurityStandards) Date(java.util.Date) MODULE_UUIDS(org.sonar.server.issue.index.IssueIndex.Facet.MODULE_UUIDS) LongBounds(org.elasticsearch.search.aggregations.bucket.histogram.LongBounds) QueryBuilders(org.elasticsearch.index.query.QueryBuilders) OWASP_TOP_10(org.sonar.server.issue.index.IssueIndex.Facet.OWASP_TOP_10) ParsedStringTerms(org.elasticsearch.search.aggregations.bucket.terms.ParsedStringTerms) BaseDoc(org.sonar.server.es.BaseDoc) FIELD_ISSUE_PROJECT_UUID(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_PROJECT_UUID) PARAM_SONARSOURCE_SECURITY(org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_SONARSOURCE_SECURITY) SONARSOURCE_SECURITY(org.sonar.server.issue.index.IssueIndex.Facet.SONARSOURCE_SECURITY) FIELD_ISSUE_DIRECTORY_PATH(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_DIRECTORY_PATH) PARAM_AUTHOR(org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_AUTHOR) SearchResponse(org.elasticsearch.action.search.SearchResponse) FIELD_ISSUE_AUTHOR_LOGIN(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_AUTHOR_LOGIN) TAGS(org.sonar.server.issue.index.IssueIndex.Facet.TAGS) DateHistogramInterval(org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramInterval) SubAggregationHelper(org.sonar.server.es.searchrequest.SubAggregationHelper) FIELD_ISSUE_EFFORT(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_EFFORT) System2(org.sonar.api.utils.System2) Terms(org.elasticsearch.search.aggregations.bucket.terms.Terms) VULNERABILITY(org.sonar.api.rules.RuleType.VULNERABILITY) Collection(java.util.Collection) DIRECTORIES(org.sonar.server.issue.index.IssueIndex.Facet.DIRECTORIES) RESOLUTIONS(org.sonar.server.issue.index.IssueIndex.Facet.RESOLUTIONS) PARAM_SANS_TOP_25(org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_SANS_TOP_25) TopAggregationDefinition(org.sonar.server.es.searchrequest.TopAggregationDefinition) FilterAggregationBuilder(org.elasticsearch.search.aggregations.bucket.filter.FilterAggregationBuilder) Collectors(java.util.stream.Collectors) String.format(java.lang.String.format) Preconditions.checkState(com.google.common.base.Preconditions.checkState) Objects(java.util.Objects) TopAggregationHelper(org.sonar.server.es.searchrequest.TopAggregationHelper) BaseDoc.epochMillisToEpochSeconds(org.sonar.server.es.BaseDoc.epochMillisToEpochSeconds) ASSIGNEES(org.sonar.server.issue.index.IssueIndex.Facet.ASSIGNEES) List(java.util.List) SearchOptions(org.sonar.server.es.SearchOptions) SecurityReviewRating.computeRating(org.sonar.server.security.SecurityReviewRating.computeRating) MultiBucketsAggregation(org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation) AllFilters(org.sonar.server.es.searchrequest.RequestFiltersComputer.AllFilters) SCOPES(org.sonar.server.issue.index.IssueIndex.Facet.SCOPES) MoreCollectors.uniqueIndex(org.sonar.core.util.stream.MoreCollectors.uniqueIndex) Optional(java.util.Optional) BoolQueryBuilder(org.elasticsearch.index.query.BoolQueryBuilder) SQCategory(org.sonar.server.security.SecurityStandards.SQCategory) IntStream(java.util.stream.IntStream) IncludeExclude(org.elasticsearch.search.aggregations.bucket.terms.IncludeExclude) FACET_MODE_EFFORT(org.sonarqube.ws.client.issue.IssuesWsParameters.FACET_MODE_EFFORT) AggregationBuilder(org.elasticsearch.search.aggregations.AggregationBuilder) CWES_BY_CWE_TOP_25(org.sonar.server.security.SecurityStandards.CWES_BY_CWE_TOP_25) PARAM_RULES(org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_RULES) EsUtils.escapeSpecialRegexChars(org.sonar.server.es.EsUtils.escapeSpecialRegexChars) Sorting(org.sonar.server.es.Sorting) FIELD_ISSUE_MODULE_UUID(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_MODULE_UUID) SANS_TOP_25_POROUS_DEFENSES(org.sonar.server.security.SecurityStandards.SANS_TOP_25_POROUS_DEFENSES) FIELD_ISSUE_MODULE_PATH(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_MODULE_PATH) OptionalInt(java.util.OptionalInt) EsUtils(org.sonar.server.es.EsUtils) FIELD_ISSUE_SEVERITY(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_SEVERITY) SECURITY_HOTSPOT(org.sonar.api.rules.RuleType.SECURITY_HOTSPOT) PARAM_TAGS(org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_TAGS) FIELD_ISSUE_LANGUAGE(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_LANGUAGE) SANS_TOP_25_INSECURE_INTERACTION(org.sonar.server.security.SecurityStandards.SANS_TOP_25_INSECURE_INTERACTION) MoreCollectors(org.sonar.core.util.stream.MoreCollectors) FIELD_ISSUE_SANS_TOP_25(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_SANS_TOP_25) QueryBuilders.termsQuery(org.elasticsearch.index.query.QueryBuilders.termsQuery) TYPES(org.sonar.server.issue.index.IssueIndex.Facet.TYPES) PARAM_CWE(org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_CWE) FIELD_ISSUE_FUNC_UPDATED_AT(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_FUNC_UPDATED_AT) FIELD_ISSUE_SQ_SECURITY_CATEGORY(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_SQ_SECURITY_CATEGORY) FIELD_ISSUE_COMPONENT_UUID(org.sonar.server.issue.index.IssueIndexDefinition.FIELD_ISSUE_COMPONENT_UUID) TermsLookup(org.elasticsearch.indices.TermsLookup) AggregationBuilders(org.elasticsearch.search.aggregations.AggregationBuilders) PeriodStart(org.sonar.server.issue.index.IssueQuery.PeriodStart) ParsedValueCount(org.elasticsearch.search.aggregations.metrics.ParsedValueCount) Consumer(java.util.function.Consumer) Collectors.toList(java.util.stream.Collectors.toList) Issue(org.sonar.api.issue.Issue) NO_EXTRA_FILTER(org.sonar.server.es.searchrequest.TopAggregationHelper.NO_EXTRA_FILTER) UserSession(org.sonar.server.user.UserSession) Collections(java.util.Collections) CheckForNull(javax.annotation.CheckForNull) IndexType(org.sonar.server.es.IndexType) QueryBuilders.existsQuery(org.elasticsearch.index.query.QueryBuilders.existsQuery) QueryBuilder(org.elasticsearch.index.query.QueryBuilder) BoolQueryBuilder(org.elasticsearch.index.query.BoolQueryBuilder)

Aggregations

SearchSourceBuilder (org.elasticsearch.search.builder.SearchSourceBuilder)4 RequestFiltersComputer (org.sonar.server.es.searchrequest.RequestFiltersComputer)4 AllFilters (org.sonar.server.es.searchrequest.RequestFiltersComputer.AllFilters)4 SearchResponse (org.elasticsearch.action.search.SearchResponse)3 Arrays (java.util.Arrays)2 Collection (java.util.Collection)2 List (java.util.List)2 Map (java.util.Map)2 Objects (java.util.Objects)2 Set (java.util.Set)2 Consumer (java.util.function.Consumer)2 IntStream (java.util.stream.IntStream)2 Stream (java.util.stream.Stream)2 Nullable (javax.annotation.Nullable)2 SearchRequest (org.elasticsearch.action.search.SearchRequest)2 BoolQueryBuilder (org.elasticsearch.index.query.BoolQueryBuilder)2 QueryBuilder (org.elasticsearch.index.query.QueryBuilder)2 QueryBuilders.boolQuery (org.elasticsearch.index.query.QueryBuilders.boolQuery)2 QueryBuilders.rangeQuery (org.elasticsearch.index.query.QueryBuilders.rangeQuery)2 QueryBuilders.termQuery (org.elasticsearch.index.query.QueryBuilders.termQuery)2