Skip to content

Labels as a facet: Aggregations API for labels

Dmitry Gruzd requested to merge 369540-aggregation-api into master

What does this MR do and why?

This feature is behind a feature flag search_issue_label_aggregation.

This MR adds issues to the SearchController#aggregations endpoint. It uses the new label_ids field that has been introduced in !96153 (merged).

This is how an example response looks like:

[
  {
    "name": "labels",
    "buckets": [
      {
        "key": "115",
        "count": 390,
        "title": "Awaiting feedback",
        "color": "#fef2c0",
        "type": "ProjectLabel",
        "parent_full_name": "qa-perf-testing / gitlabhq"
      }
    ]
  }
]

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

  1. Enable Advanced Search
  2. Enable the feature flag
Feature.enable(:search_issue_label_aggregation)
  1. Execute curl "http://localhost:3000/search/aggregations?scope=issues&search=*"
  2. Ensure that this command returns all indexed labels for issues

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #369540 (closed)

Edited by Dmitry Gruzd

Merge request reports