This is the documentation for Recommendations AI, Retail Search, and the new Retail console. To use Retail Search in the restricted GA phase, contact Cloud sales.

If you are only using Recommendations AI, remain on the Recommendations console and refer to the Recommendations AI documentation.

Auto-completion

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.

Overview

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 sh.

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.

Device Type

Retail Search auto-completion supports different device types, such as MOBILE and 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.

For a generated completion dataset based on search user events, set user_agent in UserEvent.user_info to support different device types. See user agent in wiki.

Suggestion Dataset

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.

Dataset Controls

Allowlist

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.

Allowlisted phrases are never filtered out from suggestions. The allowlist works for both uploaded completion datasets and generated completion datasets.

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.

Denylist

The phrases in a denylist will never appear in suggestions. See detailed upload instruction in import completion data.

Get completion

Follow the CompleteQuery api to fetch the suggestions. Example:

cURL

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"