Allow searches using 'query' as a parameter
What does this MR do and why?
URLs with a query string will trigger a search on the search page: https://docs.gitlab.com/search/?q=computers
Before we switched to Google, the query string looked like this: https://docs.gitlab.com/search/?query=computers
Because the Handbook documents visiting the URL directly as a method to quickly run a Docs search (https://about.gitlab.com/handbook/tools-and-tips/searching/), we should be backwards-compatible by allowing query
to be read as the query string, in addition to q
(which is the Google default).
Screenshots, screen recordings, or links to review app
No visual changes.
You can validate this on the review app by visiting both these URLs. They should both return search results:
- https://gps-query-str-backwards-compat.docs.gitlab-review.app/search/?q=docker
- https://gps-query-str-backwards-compat.docs.gitlab-review.app/search/?query=docker
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
-
Configure a local GitLab Docs environment: https://gitlab.com/gitlab-org/gitlab-docs/-/blob/main/doc/setup.md. -
Compile and run the local site with Google search:
make clean && GOOGLE_SEARCH_KEY="AIzaSyAUCkVNs7JsHYKISjVrVv1PGXg9WQr1MCQ" SEARCH_BACKEND="google" bundle exec nanoc compile
bundle exec nanoc view
-
Verify you can see search results using both query parameters:
(If you use query=
, you'll see the URL change to q=
, but it should still work.)
Merge request acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this merge request.