Advanced Search - Implement sorting for work items
Currently GLQL support sorting work items by the following fields https://docs.gitlab.com/user/glql/fields/#fields-to-sort-embedded-views-by.
These sorting field are being mapped to the following values on the API level:
| GLQL field | ES field |
|---|---|
created asc |
created_asc |
created desc |
created_desc |
updated asc |
updated_asc |
updated desc |
updated_desc |
health asc |
health_status_asc |
health desc |
health_status_desc |
weight asc |
weight_asc |
weight desc |
weight_desc |
closed asc |
closed_at_asc |
closed desc |
closed_at_desc |
due asc |
due_date_asc |
due desc |
due_date_desc |
milestone asc |
milestone_due_asc |
milestone desc |
milestone_due_desc |
popularity asc |
popularity_asc |
popularity desc |
popularity_desc |
Code wise the ES sorting is happening here https://gitlab.com/gitlab-org/gitlab/blob/e0c963a4dc6e2b1687769d4993a0fea0689f8a52/ee/lib/search/elastic/sorts.rb#L9-9. We need to update the existing build_sort method to support all the remaining fields from the table above.
Edited by Alisa Frunza