Search and browse

This document aims to clarify the distinctions between search and browse functionalities within Vertex AI Search for commerce in order to explore how to configure each effectively and get more out of them.

Understand the core differences

While search and browse help customers find products, they cater to different user journeys and require distinct configurations.

Driven by user intent, where a shopper enters a specific query, such as red running shoes. Vertex AI Search for commerce analyzes this query to understand the user's needs and returns relevant products optimized for revenue.

In short, for search, Vertex AI Search for commerce is responsible for the relevance of products and its ranking ( revenue optimized).

Browse

Guided by predefined categories, where a shopper navigates through product listings organized by attributes like brand, category, or promotions, such as Shirtsin the Men's Clothingcategory. You define these categories, displaying products in them.

You're responsible for the relevance of products listed (through filters), and Vertex AI Search for commerce is responsible for its ranking (revenue-optimized).

Configure search and browse

The beauty of Vertex AI Search for commerce lies in its unified API for both search and browse requests.

Configure search

User events for search should have these fields, along with other standard mandatory fields for user events ( eventType = "search" ):

  • Text query: The core of a search request. It captures the user's search intent.
  • Filters (Optional): Allow users to refine search results by applying facets like brand, price range, or color.
  • Ranking and Personalization: Vertex AI Search for commerce automatically optimizes the ranking of search results based on relevance and potential revenue. Personalization further tailors results based on individual user behavior.
 # Construct the search request 
 search_request 
 = 
 { 
 "query" 
 : 
 "red running shoes" 
 , 
 # User's search query 
 "filter" 
 : 
 "brand:ANY('Nike')" 
 , 
 # Optional filter 
 "page_size" 
 : 
 10 
 # Number of results per page 
 } 
 

# Send the request to the VAIS:Commerce API search_response = client . search ( search_request )

# Process the search results for product in search_response . results : print ( product . title , product . price )

For basic querying with search, including text query searches, browse searches, pagination, optimization, and personalized results, refer to Get search results .

Configure browse

User events for browse searches must have these fields, along with other standard mandatory fields for user events ( eventType = "search" for browse events):

  • Page categories: page_categories represents the category or banner under which products appear. Although, in physical client libraries or older APIs, this field might still appear as the singular page_category . The plural can optionally be the same as categories[] in the catalog. It just must represent the category that the filter represents.

  • Compulsory filter: Defines the criteria for products to be included in the browse results. This ensures only relevant products appear in the category.

  • Alignment between event and request: The user event corresponding to the browse action should contain the same page_categories and filter values matching what was passed in the API request.

  • Browse and filter set with the same value: To set the pageCategories (browse) and attributes.pageCategories (filter) fields with the same value, create a non-searchable attributes.pageCategories object, and list every page this product should appear in to facilitate filtering.

For browse filters, fields like category or categoryid , as shown in these examples, are typically custom attributes that you provide.

Here are the aforementioned four examples of different browse request options. (Just choose one format.).

 # a browse request with a custom category attribute 
 browse_request 
 = 
 { 
 "page_categories" 
 : 
 [ 
 "Men's > Clothing > Shirts" 
 ], 
 # Represents full taxonomy Path on the site 
 "filter" 
 : 
 "category:ANY('Shirts') AND gender: ANY('Male')" 
 , 
 # Compulsory filter on custom attribute 
 "page_size" 
 : 
 10 
 } 
 # a browse request showing category ID (Men's shirts custom id) 
 browse_request 
 = 
 { 
 "page_categories" 
 : 
 [ 
 "Men's > Clothing > Shirts" 
 ], 
 "filter" 
 : 
 "categoryid:ANY(1234)" 
 , 
 # Another custom attribute for categories 
 "page_size" 
 : 
 10 
 } 
 # another example showing category ID's (Men's shirts custom id) 
 browse_request 
 = 
 { 
 "page_categories" 
 : 
 [ 
 "1234" 
 ], 
 # Also ok to use unique category id's here 
 "filter" 
 : 
 "categoryid:ANY(1234)" 
 , 
 "page_size" 
 : 
 10 
 } 
 # browse and filter set with the same value 
 browse_request 
 = 
 { 
 "page_category" 
 : 
 [ 
 "Men's > Clothing > Shirts" 
 ], 
 # Browse category 
 "filter" 
 : 
 "attributes.pageCategories:ANY('Men's > Clothing > Shirts')" 
 , 
 # Compulsory filter 
 "page_size" 
 : 
 10 
 # Number of results per page 
 } 
 # Send the request to the API 
 browse_response 
 = 
 client 
 . 
 search 
 ( 
 browse_request 
 ) 
 # Process the browse results 
 for 
 product 
 in 
 browse_response 
 . 
 results 
 : 
 print 
 ( 
 product 
 . 
 title 
 , 
 product 
 . 
 price 
 ) 
Design a Mobile Site
View Site in Mobile | Classic
Share by: