Skip to content

insights: attach aggregation logic to resolver

Administrator requested to merge cw/attach-agg-resolver into main

Created by: chwarwick

Attaches the aggregation logic to the resolver Adds an additional mode to the results because clients need to know what mode is returned if they pass a null to get the default back.

Test plan

execute manual gql request and validate results

{
  searchQueryAggregate(query: "context:global worker", patternType: standard) {
    aggregations(mode: REPO, limit: 10) {
      __typename
      ... on ExhaustiveSearchAggregationResult {
        groups {
          label
          count
          query
        }
        otherResultCount
        otherGroupCount
      }
      ... on SearchAggregationNotAvailable {
        reason
      }
    }
  }
}
{
  "data": {
    "searchQueryAggregate": {
      "aggregations": {
        "__typename": "ExhaustiveSearchAggregationResult",
        "groups": [
          {
            "label": "github.com/sgtest/megarepo",
            "count": 38490,
            "query": null
          },
          {
            "label": "github.com/sourcegraph/sourcegraph",
            "count": 6601,
            "query": null
          },
          {
            "label": "github.com/sourcegraph-testing/etcd",
            "count": 13,
            "query": null
          }
        ],
        "otherResultCount": 0,
        "otherGroupCount": 0
      }
    }
  }
}

Merge request reports

Loading