Backend merge requests milestone facet: implement search

Proposal

Backend must support queries that come in two params:

  1. milestone_title for a single milestones selected from the dropdown
  2. milestone_wildcard_id which 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

  1. Pass down a new param named milestone_title param to SearchResults class
  2. Add a new feature flag: search_mr_filter_milestone
  3. Add a new Search::Elastic::Filter method: by_milestone
  • the filter must translate the milestone_title to an ID. We can take inspiration from how label names work and use MilestoneFinder. Multiple milestones may match depending on whether the search is global, group, or project level.
  1. Update MergeRequestQueryBuilder behind the FF to use the new filter:
  • if =: add filter for milestone_id
  • if !=: add must_not for milestone_id

Params will be expected from the frontend as:

  • milestone_title and not[milestone_title] (translated to not_milestone_title to 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

  1. Pass down a new param named milestone_wildcard_id param to SearchResults class
  2. Update Search::Elastic::Filter method: by_milestone to pass milestone_wildcard_id when searching for milestones using the MilestoneFinder. The by_state filter looks like it's the right finder method to use

Params will be expected from the frontend as:

  • milestone_wildcard_id and not[milestone_wildcard_id] (translated to not_milestone_wildcard_id to 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