Skip to content

Add OR filter support for labels

Heinrich Lee Yu requested to merge 296031-or-label-filters into master

What does this MR do and why?

Adds OR filter support for labels in GraphQL

Sample SQL query for searching issues with type::bug OR type::maintenance labels.

Project-level

The label IDs are queried in a separate query so we only have label IDs here

https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/13304/commands/46674

Dashboard-level

We can't use the label ID optimization so we use the label names here. I also added a username = engwan filter here because dashboard queries are very slow because it includes all public projects. The query performs similarly to AND though so this problem isn't specific to OR queries.

https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/13304/commands/46676

How to set up and validate locally

Sample GraphQL query:

query {
  project(fullPath: "flightjs/flight") {
    issues(or: { labelNames: ["Altima", "Fiero"] }) {
      nodes {
        id
        title
        labels {
          nodes {
            title
          }
        }
      }
    }
  }
}

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 #296031 (closed)

Edited by Heinrich Lee Yu

Merge request reports