This page introduces the auto-completion feature and how to use it. Retail Search provides auto-completion for powering retailers' search box typeahead suggestions.
Auto-completion is a feature for predicting the rest of a query a user is typing, which can improve the user search experience. It can provide typeahead suggestions based on your provided BigQuery suggestion dataset or based on generated suggestions from user events you provided.
When an end user begins typing a search term on your site,
Retail Search can provide a list of suggestions that the user may want.
For example, "shoes", "shirts" might be suggested when the user types
The predictions data source can be one of the following:
A completion dataset you upload, which is used to suggest queries. See import completion data.
A machine learning-powered auto-completion dataset generated by Retail Search based on users' search events.
Retail Search auto-completion supports different device types, such as
DESKTOP. You can upload or get different suggestions based on
device types. If
device_type is not specified in
CompleteQuery, the suggestion will be across all device types.
You can upload a completion dataset or have Retail Search generate one based on user events.
Uploaded completion dataset
You can upload your own completion dataset. See detailed instruction in import completion data.
Generated completion dataset from user events
Retail Search can use user events to generate an auto-completion dataset for you. The more user events uploaded to Retail Search, the higher auto-completion quality Retail Search can provide.
Contact the Cloud Retail support team to enable the dataset generated by Retail Search.
Retail Search does post processing, such as spell correction, on auto-completion suggestions. You can create an allowlist of phrases that Retail Search should skip for post processing.
Examples: there are some intentionally misspelled brand names, such as "froot loops" instead of "fruit" or "foot". See detailed upload instruction in import completion data.
The phrases in a denylist will never appear in suggestions. See detailed upload instruction in import completion data.
Follow the CompleteQuery api to fetch the suggestions. Example:
curl -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ "https://retail.googleapis.com/v2/projects/PROJECT_NUMBER/locations/global/catalogs/default_catalog:completeQuery?query=sho&dataset=user-data&deviceType=DESKTOP&maxSuggestions=5"