Skip to content
Snippets Groups Projects

insights: provide default aggregation mode given a query

Created by: leonore

closes #40425 (closed)

follows the logic from the RFC:

Default groupings should be applied in this order (handled by backend):
1. Capture group - if the search query is a regexp and contains a capture group or entire regexp is treated as one group
2. Author - if the search type is commit or diff
3. File - if the search targets a single Repo
4. Repo

Logic for 1. will need to be uncommented with #40714

Test plan

Added unit tests and ran graphql queries for 1, 2, 3, 4 as above + for an invalid query.

query searchQueryAggregate {
  searchQueryAggregate(query: "fix type:file context:global", patternType: literal) {
    aggregations(limit: 10) {
      __typename
      ... on ExhaustiveSearchAggregationResult {
        mode
        groups {
          label
          count
          query
        }
        otherResultCount
        otherGroupCount
      }
      ... on NonExhaustiveSearchAggregationResult {
          mode
          groups {
          label
          count
          query
        }
        otherResultCount
        approximateOtherGroupCount
      }
      ... on SearchAggregationNotAvailable {
        reason
      }
    }
  }
}

Merge request reports

Merge request contains no changes

Use merge requests to propose changes to your project and discuss them with your team. To make changes, use the Code dropdown list above, then test them with CI/CD before merging.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Created by: CristinaBirkel

    Review: Approved

    Looks good. I tested it out by printing out the aggregation type and tried out some different queries. Works as expected!

Please register or sign in to reply
Loading