Skip to content

Separate Google and Lunr components

Sarah German requested to merge gps-toc-sticky into main

What does this MR do and why?

Light re-org of search code now that Algolia has been removed.

  • Renames search_form.vue to lunr_search_form.vue, as it is no longer shared between search backends; it's lunr-only.
  • Moves keyboard shortcut handling to search_helpers, as it is shared across all search components.
  • Splits google_results.vue into a separate mounting handle than the site-wide search form. The results page component includes code we don't need or want site-wide (e.g, GlPagination).

Closes #1629 (closed). This bug was caused by CSS for the Google Results component being loaded globally (specifically, the html { overflow-y: scroll; }). With this refactoring, the results component is only loaded on the /search/ page.

Screenshots, screen recordings, or links to review app

No visual changes.

How to set up and validate locally

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 the site to use Lunr and verify it still works (forms render on homepage, interior content pages, and /search; typing a query returns results; the / key works as a keyboard shortcut):
make clean && make compile && make build-lunr-index && bundle exec nanoc view
  1. Compile the site to use Google (or use the review app) and verify the same things in step 2.
make clean && GOOGLE_SEARCH_KEY="AIzaSyAUCkVNs7JsHYKISjVrVv1PGXg9WQr1MCQ" SEARCH_BACKEND="google" bundle exec nanoc compile
bundle exec nanoc view

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