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