SearchResponse

Response message for SearchService.Search method.

JSON representation
{
  "results": [
    {
      object (SearchResult)
    }
  ],
  "facets": [
    {
      object (Facet)
    }
  ],
  "totalSize": integer,
  "correctedQuery": string,
  "attributionToken": string,
  "nextPageToken": string,
  "queryExpansionInfo": {
    object (QueryExpansionInfo)
  },
  "redirectUri": string,
  "appliedControls": [
    string
  ],
  "invalidConditionBoostSpecs": [
    {
      object (ConditionBoostSpec)
    }
  ],
  "experimentInfo": [
    {
      object (ExperimentInfo)
    }
  ]
}
Fields
results[]

object (SearchResult)

A list of matched items. The order represents the ranking.

facets[]

object (Facet)

Results of facets requested by user.

totalSize

integer

The estimated total count of matched items irrespective of pagination. The count of results returned by pagination may be less than the totalSize that matches.

correctedQuery

string

Contains the spell corrected query, if found. If the spell correction type is AUTOMATIC, then the search results are based on correctedQuery. Otherwise the original query is used for search.

attributionToken

string

A unique search token. This should be included in the UserEvent logs resulting from this search, which enables accurate attribution of search model performance.

nextPageToken

string

A token that can be sent as SearchRequest.page_token to retrieve the next page. If this field is omitted, there are no subsequent pages.

queryExpansionInfo

object (QueryExpansionInfo)

Query expansion information for the returned results.

redirectUri

string

The URI of a customer-defined redirect page. If redirect action is triggered, no search is performed, and only redirectUri and attributionToken are set in the response.

appliedControls[]

string

The fully qualified resource name of applied controls.

invalidConditionBoostSpecs[]

object (ConditionBoostSpec)

The invalid SearchRequest.BoostSpec.condition_boost_specs that are not applied during serving.

experimentInfo[]

object (ExperimentInfo)

Metadata related to A/B testing [Experiment][] associated with this response. Only exists when an experiment is triggered.

SearchResult

Represents the search results.

JSON representation
{
  "id": string,
  "product": {
    object (Product)
  },
  "matchingVariantCount": integer,
  "matchingVariantFields": {
    string: string,
    ...
  },
  "variantRollupValues": {
    string: value,
    ...
  },
  "personalLabels": [
    string
  ]
}
Fields
id

string

Product.id of the searched Product.

product

object (Product)

The product data snippet in the search response. Only Product.name is guaranteed to be populated.

Product.variants contains the product variants that match the search query. If there are multiple product variants matching the query, top 5 most relevant product variants are returned and ordered by relevancy.

If relevancy can be deternmined, use matchingVariantFields to look up matched product variants fields. If relevancy cannot be determined, e.g. when searching "shoe" all products in a shoe product can be a match, 5 product variants are returned but order is meaningless.

matchingVariantCount

integer

The count of matched variant Products.

matchingVariantFields

map (key: string, value: string (FieldMask format))

If a variant Product matches the search query, this map indicates which Product fields are matched. The key is the Product.name, the value is a field mask of the matched Product fields. If matched attributes cannot be determined, this map will be empty.

For example, a key "sku1" with field mask "products.color_info" indicates there is a match between "sku1" ColorInfo and the query.

variantRollupValues

map (key: string, value: value (Value format))

The rollup matching variant Product attributes. The key is one of the SearchRequest.variant_rollup_keys. The values are the merged and de-duplicated Product attributes. Notice that the rollup values are respect filter. For example, when filtering by "colorFamilies:ANY("red")" and rollup "colorFamilies", only "red" is returned.

For textual and numerical attributes, the rollup values is a list of string or double values with type google.protobuf.ListValue. For example, if there are two variants with colors "red" and "blue", the rollup values are

{ key: "colorFamilies"
  value {
    listValue {
      values { stringValue: "red" }
      values { stringValue: "blue" }
     }
  }
}

For FulfillmentInfo, the rollup values is a double value with type google.protobuf.Value. For example, {key: "pickupInStore.store1" value { numberValue: 10 }} means a there are 10 variants in this product are available in the store "store1".

personalLabels[]

string

Specifies previous events related to this product for this user based on UserEvent with same SearchRequest.visitor_id or UserInfo.user_id.

This is set only when SearchRequest.PersonalizationSpec.mode is SearchRequest.PersonalizationSpec.Mode.AUTO.

Possible values:

  • purchased: Indicates that this product has been purchased before.

Facet

A facet result.

JSON representation
{
  "key": string,
  "values": [
    {
      object (FacetValue)
    }
  ],
  "dynamicFacet": boolean
}
Fields
key

string

The key for this facet. E.g., "colorFamilies" or "price" or "attributes.attr1".

values[]

object (FacetValue)

The facet values for this field.

dynamicFacet

boolean

Whether the facet is dynamically generated.

FacetValue

A facet value which contains value names and their count.

JSON representation
{
  "count": string,
  "minValue": number,
  "maxValue": number,

  // Union field facet_value can be only one of the following:
  "value": string,
  "interval": {
    object (Interval)
  }
  // End of list of possible types for union field facet_value.
}
Fields
count

string (int64 format)

Number of items that have this facet value.

minValue

number

The minimum value in the FacetValue.interval. Only supported on numerical facets and returned if SearchRequest.FacetSpec.FacetKey.return_min_max is true.

maxValue

number

The maximum value in the FacetValue.interval. Only supported on numerical facets and returned if SearchRequest.FacetSpec.FacetKey.return_min_max is true.

Union field facet_value. A facet value which contains values. facet_value can be only one of the following:
value

string

Text value of a facet, such as "Black" for facet "colorFamilies".

interval

object (Interval)

Interval value for a facet, such as [10, 20) for facet "price".

QueryExpansionInfo

Information describing query expansion including whether expansion has occurred.

JSON representation
{
  "expandedQuery": boolean,
  "pinnedResultCount": string
}
Fields
expandedQuery

boolean

Bool describing whether query expansion has occurred.

pinnedResultCount

string (int64 format)

Number of pinned results. This field will only be set when expansion happens and SearchRequest.QueryExpansionSpec.pin_unexpanded_results is set to true.

ExperimentInfo

Metadata for active A/B testing [Experiment][].

JSON representation
{
  "experiment": string,

  // Union field experiment_metadata can be only one of the following:
  "servingConfigExperiment": {
    object (ServingConfigExperiment)
  }
  // End of list of possible types for union field experiment_metadata.
}
Fields
experiment

string

The fully qualified resource name of the experiment that provides the serving config under test, should an active experiment exist. For example: projects/*/locations/global/catalogs/default_catalog/experiments/experimentId

Union field experiment_metadata. Information associated with the specific experiment entity being recorded. experiment_metadata can be only one of the following:
servingConfigExperiment

object (ServingConfigExperiment)

A/B test between existing Cloud Retail Search ServingConfigs.

ServingConfigExperiment

Metadata for active serving config A/B tests.

JSON representation
{
  "originalServingConfig": string,
  "experimentServingConfig": string
}
Fields
originalServingConfig

string

The fully qualified resource name of the original SearchRequest.placement in the search request prior to reassignment by experiment API. For example: projects/*/locations/*/catalogs/*/servingConfigs/*.

experimentServingConfig

string

The fully qualified resource name of the serving config [VariantArm.serving_config_id][] responsible for generating the search response. For example: projects/*/locations/*/catalogs/*/servingConfigs/*.