- HTTP request
- Path parameters
- Request body
- Response body
- Authorization scopes
- IAM Permissions
- Try it!
Performs a search.
This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.
HTTP request
POST https://retail.googleapis.com/v2beta/{placement=projects/*/locations/*/catalogs/*/placements/*}:search
The URL uses gRPC Transcoding syntax.
Path parameters
Parameters | |
---|---|
placement |
Required. The resource name of the Retail Search serving config, such as |
Request body
The request body contains data with the following structure:
JSON representation |
---|
{ "branch": string, "query": string, "visitorId": string, "userInfo": { object ( |
Fields | |
---|---|
branch |
The branch resource name, such as Use "default_branch" as the branch ID or leave this field empty, to search products under the default branch. |
query |
Raw search query. If this field is empty, the request is considered a category browsing request and returned results are based on |
visitor |
Required. A unique identifier for tracking visitors. For example, this could be implemented with an HTTP cookie, which should be able to uniquely identify a visitor on a single device. This unique identifier should not change if the visitor logs in or out of the website. This should be the same identifier as The field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned. |
user |
User information. |
page |
Maximum number of If this field is negative, an INVALID_ARGUMENT is returned. |
page |
A page token When paginating, all other parameters provided to |
offset |
A 0-indexed integer that specifies the current offset (that is, starting result location, amongst the If this field is negative, an INVALID_ARGUMENT is returned. |
filter |
The filter syntax consists of an expression language for constructing a predicate from one or more fields of the products being filtered. Filter expression is case-sensitive. For more information, see Filter. If this field is unrecognizable, an INVALID_ARGUMENT is returned. |
canonical |
The default filter that is applied when a user performs a search without checking any filters on the search page. The filter applied to every search request when quality improvement such as query expansion is needed. In the case a query does not have a sufficient amount of results this filter will be used to determine whether or not to enable the query expansion flow. The original filter will still be used for the query expanded search. This field is strongly recommended to achieve high search quality. For more information about filter syntax, see |
order |
The order in which products are returned. Products can be ordered by a field in an If this field is unrecognizable, an INVALID_ARGUMENT is returned. |
facet |
Facet specifications for faceted search. If empty, no facets are returned. A maximum of 200 values are allowed. Otherwise, an INVALID_ARGUMENT error is returned. |
dynamicFacetSpec |
Deprecated. Refer to https://cloud.google.com/retail/docs/configs#dynamic to enable dynamic facets. Do not set this field. The specification for dynamically generated facets. Notice that only textual facets can be dynamically generated. |
boost |
Boost specification to boost certain products. For more information, see Boost results. Notice that if both |
query |
The query expansion specification that specifies the conditions under which query expansion occurs. For more information, see Query expansion. |
variant |
The keys to fetch and rollup the matching For Supported keys are:
If this field is set to an invalid value other than these, an INVALID_ARGUMENT error is returned. |
page |
The categories associated with a category page. Must be set for category navigation queries to achieve good search quality. The format should be the same as To represent full path of category, use '>' sign to separate different hierarchies. If '>' is part of the category name, replace it with other character(s). Category pages include special pages such as sales or promotions. For instance, a special sale page may have the category hierarchy: "pageCategories" : ["Sales > 2017 Black Friday Deals"]. |
search |
The search mode of the search request. If not specified, a single search request triggers both product search and faceted search. |
personalization |
The specification for personalization. Notice that if both |
labels |
The labels applied to a resource must meet the following requirements:
For more information, see Requirements for labels in the Resource Manager documentation. |
entity |
The entity for customers that may run multiple different entities, domains, sites or regions, for example, |
conversational |
Optional. This field specifies all conversational related parameters addition to traditional retail search. |
tile |
Optional. This field specifies tile navigation related parameters. |
spell |
The spell correction specification that specifies the mode under which spell correction will take effect. |
Response body
If successful, the response body contains an instance of SearchResponse
.
Authorization scopes
Requires the following OAuth scope:
https://www.googleapis.com/auth/cloud-platform
For more information, see the Authentication Overview.
IAM Permissions
Requires one of the following IAM permissions on the placement
resource, depending on the resource type:
retail.placements.search
retail.servingConfigs.search
For more information, see the IAM documentation.