Skip to content

Global Search Refactor - Fix Scoped Queries

Zack Cuddy requested to merge 345745_02-better-search-queries into master

What does this MR do and why?

This addresses a two regressions (1/2) found in Staging: #345745 (comment 755164245)
This addresses a two regressions (2/2) found in Staging: #345745 (comment 755192285)
Work towards #297396 (closed)

This change is behind a feature flag (:new_header_search)
Feature Flag Rollout Issue: #339348 (closed)

This change fixes two bugs:

  1. That we were sending null search params which will soon be detected as potential abuse behavior.
  2. Fixes an issue where the Scoped search doesn't work on forked personal projects.

Context: A "Scoped Search" is the search suggestions above the horizontal line in the Header Search:

Screen_Shot_2021-12-09_at_1.15.28_PM

Thank you to @dgruzd and @changzhengliu for spotting this!

Screenshots or screen recordings

No visual changes

How to set up and validate locally

Testing null search params

  1. Fetch and checkout this branch
  2. Add Feature Flag
  3. Navigate to a project root page (ie. Flightjs/Flight)
  4. Type a search in the Header Search in the top right
  5. Ensure you get three suggestions ("term" in Flight, "term" in Flightjs, and "term" in all GitLab)
  6. Click each of those searches and ensure no null search params exist in the URL (ie, scope=null)
  7. Navigate back to a project's page but go to the Issues List
  8. Perform step 4 again
  9. Perform step 5 again but this time ensure that the scope gets set (scope=issues)

Testing Forked Projects

  1. Fetch and checkout this branch
  2. Add Feature Flag
  3. Navigate to a personal forked project (you can find these by searching Global Search for a common project like GitLab)
  4. Type a search in the Header Search in the top right
  5. Ensure you only get two suggestion ("term" in ProjectName and "term" in all GitLab)
  6. Ensure both of those links work and follow the same pattern as the above testing steps section

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Zack Cuddy

Merge request reports

Loading