Skip to content

Add a version selector to the search results page

Sarah German requested to merge gps-archives-search into main

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)
image image image

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.

  1. Configure a local GitLab Docs environment: https://gitlab.com/gitlab-org/gitlab-docs/-/blob/main/doc/setup.md.
  2. Compile with Google search backend: https://gitlab.com/gitlab-org/gitlab-docs/-/blob/main/doc/search.md#local-build-with-google-programmable-search
  3. Run a search from the search result page (e.g, http://localhost:3000/search/?q=git&page=1)
  4. Use the "search the archives" dropdown to select an older version.
  5. 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.

Edited by Sarah German

Merge request reports