Skip to content

Provide spelling suggestions for mistyped search queries

Sarah German requested to merge gps-spelling-suggestions into main

What does this MR do and why?

Sometimes people spell thigngs wrong. When Google fails to find any results in these cases, they pass a spelling suggestion back in the API response if one exists.

We can use this to more quickly help the user get where they're going.

In the case of a query without any spelling suggestions, we continue to show the same "no results" text as before.

Completes part of #1588 (closed)

Screenshots, screen recordings, or links to review app

Homepage:

Before after
image image

Results page:

Before After
image image

How to set up and validate locally

Skip to step 4 if you're testing in the review app (which should work fine).

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. Generate a build with Google search: https://gitlab.com/gitlab-org/gitlab-docs/-/blob/main/doc/search.md#local-build-with-google-programmable-search
  3. View the local site: make view
  4. From the homepage or an interior page, search for something but spell it wrong ("derprecations" "wabhook" "bortbucket" etc). You should see results for the corrected version of the term.
  5. Try the same from the /search page. Here the term is also autocorrected, but we also show text to indicate that the original query was changed.

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