Skip to content
This repository has been archived by the owner on Sep 21, 2023. It is now read-only.

Commit

Permalink
feat: add search mode to search request (#108)
Browse files Browse the repository at this point in the history
...If not specified, a single search request triggers both product search and faceted search. 

- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 404039072

Source-Link: googleapis/googleapis@8ef531e

Source-Link: https://github.com/googleapis/googleapis-gen/commit/86e91097a445a4b0972a20e4b0e3e87f9aadd2c0
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiODZlOTEwOTdhNDQ1YTRiMDk3MmEyMGU0YjBlM2U4N2Y5YWFkZDJjMCJ9

docs: Keep the API doc up-to-date 
feat: update grpc service config settings to reflect correct API deadlines
  • Loading branch information
gcf-owl-bot[bot] authored Oct 18, 2021
1 parent 3777919 commit 326576f
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ async def add_fulfillment_places(
google.api_core.operation_async.AsyncOperation:
An object representing a long-running operation.
The result type for the operation will be :class:`google.cloud.retail_v2.types.AddFulfillmentPlacesResponse` Response of the RemoveFulfillmentPlacesRequest. Currently empty because
The result type for the operation will be :class:`google.cloud.retail_v2.types.AddFulfillmentPlacesResponse` Response of the AddFulfillmentPlacesRequest. Currently empty because
there is no meaningful response populated from the
[AddFulfillmentPlaces][] method.
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/retail_v2/services/product_service/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,7 @@ def add_fulfillment_places(
google.api_core.operation.Operation:
An object representing a long-running operation.
The result type for the operation will be :class:`google.cloud.retail_v2.types.AddFulfillmentPlacesResponse` Response of the RemoveFulfillmentPlacesRequest. Currently empty because
The result type for the operation will be :class:`google.cloud.retail_v2.types.AddFulfillmentPlacesResponse` Response of the AddFulfillmentPlacesRequest. Currently empty because
there is no meaningful response populated from the
[AddFulfillmentPlaces][] method.
Expand Down
6 changes: 3 additions & 3 deletions google/cloud/retail_v2/types/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class ColorInfo(proto.Message):
only 1 color. May consider using single "Mixed" instead of
multiple values.
A maximum of 5 colors are allowed. Each value must be a
A maximum of 25 colors are allowed. Each value must be a
UTF-8 encoded string with a length limit of 128 characters.
Otherwise, an INVALID_ARGUMENT error is returned.
Expand Down Expand Up @@ -213,8 +213,8 @@ class FulfillmentInfo(proto.Message):
or the region IDs for
[FulfillmentInfo.type.same-day-delivery][google.cloud.retail.v2.FulfillmentInfo.type].
A maximum of 2000 values are allowed. Each value must be a
string with a length limit of 10 characters, matching the
A maximum of 3000 values are allowed. Each value must be a
string with a length limit of 30 characters, matching the
pattern [a-zA-Z0-9\_-]+, such as "store1" or "REGION-2".
Otherwise, an INVALID_ARGUMENT error is returned.
"""
Expand Down
11 changes: 8 additions & 3 deletions google/cloud/retail_v2/types/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,19 @@ class Product(proto.Message):
and
[ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts].
[expire_time][google.cloud.retail.v2.Product.expire_time]
must be later than
[available_time][google.cloud.retail.v2.Product.available_time]
and
[publish_time][google.cloud.retail.v2.Product.publish_time],
otherwise an INVALID_ARGUMENT error is thrown.
Google Merchant Center property
`expiration_date <https://support.google.com/merchants/answer/6324499>`__.
ttl (google.protobuf.duration_pb2.Duration):
Input only. The TTL (time to live) of the product.
If it is set,
If it is set, it must be a non-negative value, and
[expire_time][google.cloud.retail.v2.Product.expire_time] is
set as current timestamp plus
[ttl][google.cloud.retail.v2.Product.ttl]. The derived
Expand All @@ -69,8 +76,6 @@ class Product(proto.Message):
name (str):
Immutable. Full resource name of the product, such as
``projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/product_id``.
The branch ID must be "default_branch".
id (str):
Immutable. [Product][google.cloud.retail.v2.Product]
identifier, which is the final component of
Expand Down
10 changes: 5 additions & 5 deletions google/cloud/retail_v2/types/product_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ class SetInventoryRequest(proto.Message):
found, the inventory update will still be processed and
retained for at most 1 day until the
[Product][google.cloud.retail.v2.Product] is created. If set
to false, an INVALID_ARGUMENT error is returned if the
to false, a NOT_FOUND error is returned if the
[Product][google.cloud.retail.v2.Product] is not found.
"""

Expand Down Expand Up @@ -446,7 +446,7 @@ class AddFulfillmentPlacesRequest(proto.Message):
fulfillment information will still be processed and retained
for at most 1 day and processed once the
[Product][google.cloud.retail.v2.Product] is created. If set
to false, an INVALID_ARGUMENT error is returned if the
to false, a NOT_FOUND error is returned if the
[Product][google.cloud.retail.v2.Product] is not found.
"""

Expand All @@ -466,8 +466,8 @@ class AddFulfillmentPlacesMetadata(proto.Message):


class AddFulfillmentPlacesResponse(proto.Message):
r"""Response of the RemoveFulfillmentPlacesRequest. Currently empty
because there is no meaningful response populated from the
r"""Response of the AddFulfillmentPlacesRequest. Currently empty because
there is no meaningful response populated from the
[AddFulfillmentPlaces][] method.
"""
Expand Down Expand Up @@ -531,7 +531,7 @@ class RemoveFulfillmentPlacesRequest(proto.Message):
fulfillment information will still be processed and retained
for at most 1 day and processed once the
[Product][google.cloud.retail.v2.Product] is created. If set
to false, an INVALID_ARGUMENT error is returned if the
to false, a NOT_FOUND error is returned if the
[Product][google.cloud.retail.v2.Product] is not found.
"""

Expand Down
51 changes: 36 additions & 15 deletions google/cloud/retail_v2/types/search_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,9 @@ class SearchRequest(proto.Message):
Required. The resource name of the search engine placement,
such as
``projects/*/locations/global/catalogs/default_catalog/placements/default_search``.
This field is used to identify the set of models that will
be used to make the search.
We currently support one placement with the following ID:
- ``default_search``.
This field is used to identify the serving configuration
name and the set of models that will be used to make the
search.
branch (str):
The branch resource name, such as
``projects/*/locations/global/catalogs/default_catalog/branches/0``.
Expand Down Expand Up @@ -94,7 +91,8 @@ class SearchRequest(proto.Message):
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.
case-sensitive. See more details at this `user
guide <https://cloud.google.com/retail/docs/filter-and-order#filter>`__.
If this field is unrecognizable, an INVALID_ARGUMENT is
returned.
Expand All @@ -116,7 +114,8 @@ class SearchRequest(proto.Message):
ordered by a field in an
[Product][google.cloud.retail.v2.Product] object. Leave it
unset if ordered by relevance. OrderBy expression is
case-sensitive.
case-sensitive. See more details at this `user
guide <https://cloud.google.com/retail/docs/filter-and-order#order>`__.
If this field is unrecognizable, an INVALID_ARGUMENT is
returned.
Expand All @@ -134,12 +133,21 @@ class SearchRequest(proto.Message):
Contact Retail Search support team if you are
interested in using dynamic facet feature.
boost_spec (google.cloud.retail_v2.types.SearchRequest.BoostSpec):
Boost specification to boost certain
products.
Boost specification to boost certain products. See more
details at this `user
guide <https://cloud.google.com/retail/docs/boosting>`__.
Notice that if both [ServingConfig.boost_control_ids][] and
[SearchRequest.boost_spec] are set, the boost conditions
from both places are evaluated. If a search request matches
multiple boost conditions, the final boost score is equal to
the sum of the boost scores from all matched boost
conditions.
query_expansion_spec (google.cloud.retail_v2.types.SearchRequest.QueryExpansionSpec):
The query expansion specification that
specifies the conditions under which query
expansion will occur.
The query expansion specification that specifies the
conditions under which query expansion will occur. See more
details at this `user
guide <https://cloud.google.com/retail/docs/result-size#query_expansion>`__.
variant_rollup_keys (Sequence[str]):
The keys to fetch and rollup the matching
[variant][google.cloud.retail.v2.Product.Type.VARIANT]
Expand All @@ -165,6 +173,7 @@ class SearchRequest(proto.Message):
- price
- originalPrice
- discount
- inventory(place_id,price)
- attributes.key, where key is any key in the
[Product.attributes][google.cloud.retail.v2.Product.attributes]
map.
Expand Down Expand Up @@ -230,8 +239,18 @@ class SearchRequest(proto.Message):
promotions. For instance, a special sale page may have the
category hierarchy: "pageCategories" : ["Sales > 2017 Black
Friday Deals"].
search_mode (google.cloud.retail_v2.types.SearchRequest.SearchMode):
The search mode of the search request. If not
specified, a single search request triggers both
product search and faceted search.
"""

class SearchMode(proto.Enum):
r"""The search mode of each search request."""
SEARCH_MODE_UNSPECIFIED = 0
PRODUCT_SEARCH_ONLY = 1
FACETED_SEARCH_ONLY = 2

class FacetSpec(proto.Message):
r"""A facet specification to perform faceted search.
Expand Down Expand Up @@ -345,7 +364,8 @@ class FacetKey(proto.Message):
- "discount"
- "rating"
- "ratingCount"
- "attributes.key".
- "attributes.key"
- "inventory(place_id,price)".
intervals (Sequence[google.cloud.retail_v2.types.Interval]):
Set only if values should be bucketized into
intervals. Must be set for facets with numerical
Expand Down Expand Up @@ -586,6 +606,7 @@ class Condition(proto.Enum):
)
variant_rollup_keys = proto.RepeatedField(proto.STRING, number=17,)
page_categories = proto.RepeatedField(proto.STRING, number=23,)
search_mode = proto.Field(proto.ENUM, number=31, enum=SearchMode,)


class SearchResponse(proto.Message):
Expand Down Expand Up @@ -772,7 +793,7 @@ class QueryExpansionInfo(proto.Message):
pinned_result_count (int):
Number of pinned results. This field will only be set when
expansion happens and
[SearchRequest.query_expansion_spec.pin_unexpanded_results][]
[SearchRequest.QueryExpansionSpec.pin_unexpanded_results][google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.pin_unexpanded_results]
is set to true.
"""

Expand Down
8 changes: 4 additions & 4 deletions google/cloud/retail_v2/types/user_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ class UserEvent(proto.Message):
In a ``search`` event, this field represents the products
returned to the end user on the current page (the end user
may have not finished broswing the whole page yet). When a
may have not finished browsing the whole page yet). When a
new page is returned to the end user, after
pagination/filtering/ordering even for the same query, a new
``search`` event with different
[product_details][google.cloud.retail.v2.UserEvent.product_details]
is desired. The end user may have not finished broswing the
is desired. The end user may have not finished browsing the
whole page yet.
completion_detail (google.cloud.retail_v2.types.CompletionDetail):
The main completion details related to the event.
Expand All @@ -149,7 +149,7 @@ class UserEvent(proto.Message):
site. Users can arrive at the site by coming to the site
directly, or coming through Google search, and etc.
cart_id (str):
The id or name of the associated shopping cart. This id is
The ID or name of the associated shopping cart. This ID is
used to associate multiple items added or present in the
cart before purchase.
Expand Down Expand Up @@ -254,7 +254,7 @@ class UserEvent(proto.Message):
JavaScript pixel and Google Tag Manager, this
value is filled in automatically.
page_view_id (str):
A unique id of a web page view.
A unique ID of a web page view.
This should be kept the same for all user events triggered
from the same pageview. For example, an item detail page
Expand Down
2 changes: 1 addition & 1 deletion scripts/fixup_retail_v2_keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class retailCallTransformer(cst.CSTTransformer):
'purge_user_events': ('parent', 'filter', 'force', ),
'rejoin_user_events': ('parent', 'user_event_rejoin_scope', ),
'remove_fulfillment_places': ('product', 'type_', 'place_ids', 'remove_time', 'allow_missing', ),
'search': ('placement', 'visitor_id', 'branch', 'query', 'user_info', 'page_size', 'page_token', 'offset', 'filter', 'canonical_filter', 'order_by', 'facet_specs', 'dynamic_facet_spec', 'boost_spec', 'query_expansion_spec', 'variant_rollup_keys', 'page_categories', ),
'search': ('placement', 'visitor_id', 'branch', 'query', 'user_info', 'page_size', 'page_token', 'offset', 'filter', 'canonical_filter', 'order_by', 'facet_specs', 'dynamic_facet_spec', 'boost_spec', 'query_expansion_spec', 'variant_rollup_keys', 'page_categories', 'search_mode', ),
'set_default_branch': ('catalog', 'branch_id', 'note', ),
'set_inventory': ('inventory', 'set_mask', 'set_time', 'allow_missing', ),
'update_catalog': ('catalog', 'update_mask', ),
Expand Down

0 comments on commit 326576f

Please sign in to comment.