Provide spelling suggestions for mistyped search queries
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 |
---|---|
![]() |
![]() |
Results page:
Before | After |
---|---|
![]() |
![]() |
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.
-
Configure a local GitLab Docs environment: https://gitlab.com/gitlab-org/gitlab-docs/-/blob/main/doc/setup.md. -
Generate a build with Google search: https://gitlab.com/gitlab-org/gitlab-docs/-/blob/main/doc/search.md#local-build-with-google-programmable-search -
View the local site: make view
-
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. -
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.
-
I have evaluated the MR acceptance checklist for this merge request.
Edited by Sarah German