Skip to content

insights: schema and empty resolvers for search aggregations

Administrator requested to merge cw/aggregations-schema into main

Created by: chwarwick

Adds a graphql schema and resolvers that return not yet supported responses for search aggregations. A follow up PR will add the functionality once the capabilities are added.

closes https://github.com/sourcegraph/sourcegraph/issues/40212

Test plan

Manually verify queries return not available

Check aggregations are not yet available

{
  searchQueryAggregate(query: "todo", patternType: standard) {
    aggregations(mode: REPO, limit: 100) {
      __typename
      ... on NonExhaustiveSearchAggregationResult {
        groups {
          label
          count
          query
        }
        otherResultCount
        approximateOtherGroupCount
        supportsPersistence
      }
      ... on ExhaustiveSearchAggregationResult {
        groups {
          label
          count
          query
        }
        otherResultCount
        otherGroupCount
        supportsPersistence
      }
      ... on SearchAggregationNotAvailable {
        reason
      }
    }
  }
}
{
  "data": {
    "searchQueryAggregate": {
      "aggregations": {
        "__typename": "SearchAggregationNotAvailable",
        "reason": "not implemented"
      }
    }
  }
}

Check all modes indicate they are not available

{
  searchQueryAggregate(query: "todo", patternType: standard) {
    modeAvailability {
      mode
      available
      reasonUnavailable
    }
  }
}
{
  "data": {
    "searchQueryAggregate": {
      "modeAvailability": [
        {
          "mode": "REPO",
          "available": false,
          "reasonUnavailable": "not implemented"
        },
        {
          "mode": "PATH",
          "available": false,
          "reasonUnavailable": "not implemented"
        },
        {
          "mode": "AUTHOR",
          "available": false,
          "reasonUnavailable": "not implemented"
        },
        {
          "mode": "CAPTURE_GROUP",
          "available": false,
          "reasonUnavailable": "not implemented"
        }
      ]
    }
  }
}

Merge request reports

Loading