Add a version selector to the search results page
What does this MR do and why?
Adds a version selector to the search results page, and updates the page title to indicate that Search on docs.gitlab.com runs against the latest docs.
When the visitor picks a version, they are redirected to search results for their query on the appropriate archive site.
We have technical reasons for not using the same Google search engine for all versions of the site. At this time, our best option is to send people over to their desired archive version and run the search there, using version-scoped Lunr.js (which is already in place).
Why
- Visitors using self-managed GitLab need a way to run a search against older versions of the docs.
- It is currently unclear that search on docs.gitlab.com searches the latest docs.
Closes #1624 (closed)
Screenshots, screen recordings, or links to review app
Review app: https://gps-archives-search.docs.gitlab-review.app/search/?q=git&page=1
Before | After | After (tooltip) |
---|---|---|
How to set up and validate locally
Skip to step 3 if using the review app: https://gps-archives-search.docs.gitlab-review.app/search/?q=git&page=1
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 with Google search backend: https://gitlab.com/gitlab-org/gitlab-docs/-/blob/main/doc/search.md#local-build-with-google-programmable-search -
Run a search from the search result page (e.g, http://localhost:3000/search/?q=git&page=1) -
Use the "search the archives" dropdown to select an older version. -
Verify you're redirected to the correct archives site search, pre-populated with your previous query
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.