diff options
author | Sarah German <sgerman@gitlab.com> | 2023-05-10 23:14:59 +0300 |
---|---|---|
committer | Sarah German <sgerman@gitlab.com> | 2023-05-10 23:14:59 +0300 |
commit | 5354619e4506c409799c103288568265e343606f (patch) | |
tree | c2abf4a8315dc624aeb0e21dc1fc8446e5c57681 | |
parent | c769609177eb884f599d41c4bec9cb9306a6ef83 (diff) |
Allow searches using 'query' as a parameter
-rw-r--r-- | content/frontend/search/search_helpers.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/content/frontend/search/search_helpers.js b/content/frontend/search/search_helpers.js index 45048fab..5b6cd858 100644 --- a/content/frontend/search/search_helpers.js +++ b/content/frontend/search/search_helpers.js @@ -5,11 +5,18 @@ /** * Check URL parameters for search queries. * + * We support "q" as it's a Google standard, and + * also "query" as it has been long-documented in the + * GitLab handbook as a Docs search parameter. + * + * See https://about.gitlab.com/handbook/tools-and-tips/searching/ + * * @returns * The query string if it exists, or an empty string. */ export const getSearchQueryFromURL = () => { - return new URLSearchParams(window.location.search).get('q') || ''; + const searchParams = new URLSearchParams(window.location.search); + return searchParams.get('q') || searchParams.get('query') || ''; }; /** |