feat(java/ui) Add search suggestions to our search experience #8710
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements requesting for search suggestions on the new virtual
_entityName
field which is on all of our searchable entities. Right now it's configured by default with everything so it only returns suggestions if there are no results that come back. This can be fine-tuned.We only actually ask for suggestions though if we pass a new search flag in asking for suggestions. I'm only doing this on our main search page on the frontend.
Caveat: Elasticsearch term suggesters does not take into account filters so it always gives suggestions based on no filters applied. This seems like a real gap for elastic right now and was not something Indy or myself could figure out how to get them to be applied.
We are now returning an optional list of suggestions on searchAcrossEntities which I expect to be used in the UI but not from anyone using our API.
On the frontend, if there are search results and suggestions, render the suggestion on the top left sayng "Did you mean {suggestion}" and clicking it routed them to search for that new query with all filters cleared.
If there are no search results, the design of what we say has changed to suggest clearing filters / selected view and show any suggested text if it exists. If there is no suggested text and no filters/view then we show the old "Explore all" button.
Screenshots:
Checklist