Query expansion is the incremental loosening of query constraints to include more results when none or too few are initially found. This leads to an adjustment of the result size per query.
Query expansion tutorial
This tutorial shows you how to enable the query expansion feature. When a shopper uses an ambiguous or a multi-word search phrase, they can get an empty response. After turning on query expansion, the request is analyzed and the expanded list of products based on the parsed search query gets returned.
To follow step-by-step guidance for this task directly in the
Cloud Shell Editor, click Guide me:
Guide me
Example dataset
This page uses the following dataset as an example. Only the fields necessary
for explanation are included.
Example product dataset
ID |
title |
brands |
categories |
price_info.price |
"nest_mini_2nd_gen" |
"Nest Mini (2nd gen)" |
["Google", "Nest"] |
["Nest > speakers and displays"] |
49.00 |
"nest_audio" |
"Nest Audio" |
["Google", "Nest"] |
["Nest > speakers and displays"] |
99.99 |
"nest_hub_max" |
"Nest Hub Max" |
["Google", "Nest"] |
["Nest > speakers and displays"] |
229.00 |
"nest_hub" |
"Nest Hub" |
["Google", "Nest"] |
["Nest > speakers and displays"] |
88.99 |
"google_home_max" |
"Google Home Max" |
["Google", "Nest"] |
["Nest > speakers and displays"] |
299.00 |
"google_home_mini" |
"Google Home Mini" |
["Google", "Nest"] |
["Nest > speakers and displays"] |
49.00 |
"google_pixel_5" |
"Google Pixel 5" |
["Google", "Pixel"] |
["Pixel > phones"] |
699.00 |
"google_pixel_4a_with_5g" |
"Google Pixel 4a with 5G" |
["Google", "Pixel"] |
["Pixel > phones"] |
499.00 |
"google_pixel_4a" |
"Google Pixel 4a Phones" |
["Google", "Pixel"] |
["Pixel > phones"] |
349.00 |
"google_pixel_stand" |
"Google Pixel Stand" |
["Google", "Pixel"] |
["Pixel > featured accessories"] |
79.00 |
"google_pixel_buds" |
"Google Pixel Buds" |
["Google", "Pixel"] |
["Pixel > featured accessories"] |
179.00 |
"google_pixel_5_case" |
"Google Pixel 5 Case" |
["Google", "Pixel"] |
["Pixel > featured accessories"] |
40.00 |
"google_pixel_4a_5g_case" |
"Google Pixel 4a (5G) Case" |
["Google", "Pixel"] |
["Pixel > featured accessories"] |
40.00 |
"google_pixel_4a_case" |
"Google Pixel 4a Case" |
["Google", "Pixel"] |
["Pixel > featured accessories"] |
40.00 |
Query expansion
Query expansion increases the recall for query terms with few results,
especially long tail queries.
For example, if you search "Google Pixel 5" without query expansion, you might
only get "google_pixel_5" in the result. With query expansion, you might get
"google_pixel_4a_with_5g", "google_pixel_4a" and "google_pixel_5_case" as well.