Skip to content

Filter merge requests by target branch

Madelein van Niekerk requested to merge 463375-target-branch-mr-filter into master

What does this MR do and why?

Related to #463375 (closed)

Feature flag: search_mr_filter_target_branch

This MR adds a the target_branch filter to SearchService for merge requests.

The backend will accept target_branch for = and not[target_branch] for != searches.

The frontend is expected to only send one param, but the backend will allow both. If both are supplied an OR operation is done

MR acceptance checklist

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

Screenshots or screen recordings

Search filter Screenshot
No filter

Screenshot 2024-07-22 at 11.50.32.png

target_branch=branch1

Screenshot 2024-07-22 at 11.47.23.png

not[target_branch]=branch1

Screenshot 2024-07-22 at 11.51.12.png

How to set up and validate locally

  1. enable elasticsearch for gdk, and index everything using gitlab:elastic:index rake task
  2. pick a project
  3. create two merge requests with the same searchable text
  4. note the branch names (i used the web IDE editor to create the merge requests easily)
  5. Enable the feature flag search_mr_filter_target_branch
  6. search for the text in the project
  1. verify all results come back
  2. add the target_branch=BRANCH_NAME param to the URL
  1. verify only the result from that branch comes back
  2. add the not[target_branch]=BRANCH_NAME param to the original URL
  1. verify the result from that branch does not come back

NOTE: You can repeat the test for group and global search

Edited by Madelein van Niekerk

Merge request reports

Loading