Backend merge requests milestone facet: implement search
Proposal
Backend must support queries that come in two params:
-
milestone_titlefor a single milestones selected from the dropdown -
milestone_wildcard_idwhich accepts values of:'none', 'any', 'upcoming', 'started'
If both milestone_title and milestone_wildcard_id are sent, there should be an error raised. You cannot send both
Searching by milestone_title
- Pass down a new param named
milestone_titleparam toSearchResultsclass - Add a new feature flag:
search_mr_filter_milestone - Add a new
Search::Elastic::Filtermethod:by_milestone
- the filter must translate the
milestone_titleto an ID. We can take inspiration from how label names work and useMilestoneFinder. Multiple milestones may match depending on whether the search is global, group, or project level.
- Update
MergeRequestQueryBuilderbehind the FF to use the new filter:
- if
=: addfilterformilestone_id - if
!=: addmust_notformilestone_id
Params will be expected from the frontend as:
-
milestone_titleandnot[milestone_title](translated tonot_milestone_titleto be translated into ids before sending to Elasticsearch)
If both not and equal milestone_title params are sent, perform an OR operation by combining into a should query.
Searching by milestone_wildcard_id
- Pass down a new param named
milestone_wildcard_idparam toSearchResultsclass - Update
Search::Elastic::Filtermethod:by_milestoneto passmilestone_wildcard_idwhen searching for milestones using theMilestoneFinder. Theby_statefilter looks like it's the right finder method to use
Params will be expected from the frontend as:
-
milestone_wildcard_idandnot[milestone_wildcard_id](translated tonot_milestone_wildcard_idto be translated into ids before sending to Elasticsearch)
If both not and equal milestone_wildcard_id params are sent, perform an OR operation by combining into a should query.
Edited by Terri Chu