With the Suggest API, you get real-time autocomplete suggestions as users type their search queries for places or categories. Results are ranked by relevance, with the most likely matches appearing first. The API response includes highlighting information that shows how each suggestion matches the user's query.
Potential use cases
Use highlighting to show users which parts of each suggestion match their input, making it easier to quickly select the desired result.
Examples
When displaying the result list to users, the Highlights fields in the response can be used to help the user identify how the input has been matched to the results. In the example below, the user makes a query for “Effel tow”. This matches a result with the Title “Tour Eiffel (Eiffel Tower)”. Using the Highlights result field, the result can be styled to show where the input query was matched to the output, resulting in the text being showed to the user as “Tour Eiffel (Eiffel Tower).”
This example demonstrates how to use the Suggest API to look up a misspelled point of interest.
Developer tips
Display search results using the Title
response field to provide
users with concise, recognizable entries. For results that might look similar, use
the Place.Address.Label
field to show additional address details that
help users distinguish between them. For more information, see How to help users disambiguate between
similar results.