Advanced search - allow queries for weight in work item index

What does this MR do and why?

This MR adds support for GLQL weight query in Elasticsearch. Below is the example mapping (GLQL field => Glql::WorkItemsFinder parameters => Search::Elastic::Filter parameter) of all possible variations for weight field:

Specific Weight Queries

GLQL Query WorkItems Finder ES Filter Name
weight = 1 weight: "1" weight: 1
weight != 1 not: {weight: "1"} not_weight: 1

Combined Weight Queries

GLQL Query WorkItems Finder ES Filter Name
weight = 2 and weight != 1 weight: "2", not: {weight: "1"} weight: 2, not_weight: 1
weight != 2 and weight = any weight_wildcard_id: "ANY", not: {weight: "2"} not_weight: 2, any_weight: true

Wildcard Weight Queries

GLQL Query WorkItems Finder ES Filter Name
weight = any weight_wildcard_id: "ANY" any_weight
weight != any weight_wildcard_id: "NONE" none_weight
weight = none weight_wildcard_id: "NONE" none_weight
weight != none weight_wildcard_id: "ANY" any_weight
weight = null weight_wildcard_id: "NONE" none_weight

References

Screenshots or screen recordings

Before After

How to set up and validate locally

  1. Follow this guide to have ES enabled locally for GDK
  2. GLQL relies on crypto.subtle, which is unavailable in insecure contexts (except for localhost), it won’t work if you're using a custom URL like http://gdk.test:3000 locally. To resolve this, one of the options is to enable HTTPS in GDK by following this link.
  3. Enable the following feature flags in rails c:
=> Feature.enable(:glql_integration)
=> Feature.enable(:glql_work_items)
=> Feature.enable(:glql_es_integration)
  1. Navigate to any issue comment or description field where Markdown is supported
  2. Add the following GLQL query into the field:
```glql
display: table
fields: title, labels("workflow::*"), author, labels
query: group = "gitlab-org" and weight = 1
```
  1. Test with different weight fields variations provided above in the MR description section.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #540813 (closed)

Edited by Alisa Frunza

Merge request reports

Loading