Skip to content

Commit

Permalink
feat: support merged facets (#7382)
Browse files Browse the repository at this point in the history
feat: add product purge API
feat: add page_categories to control condition
feat: support attribute suggestion in autocomplete
feat: support frequent bought together model config
feat: allow to skip denylist postfiltering in recommendations
chore: deprecate recent search result in autocomplete
docs: keep the API doc up-to-date with recent changes
PiperOrigin-RevId: 641043920
Source-Link: googleapis/googleapis@7660854
Source-Link: googleapis/googleapis-gen@f62c255
Copy-Tag: eyJwIjoiUmV0YWlsLy5Pd2xCb3QueWFtbCIsImgiOiJmNjJjMjU1NWFmYzc3ZGQyNmRiMDIxNmM3YWIwODdiZTcxY2E2YmZjIn0=
  • Loading branch information
gcf-owl-bot[bot] authored Jun 7, 2024
1 parent 9b419c4 commit c5ea1f3
Show file tree
Hide file tree
Showing 63 changed files with 3,414 additions and 465 deletions.
Binary file modified Retail/metadata/V2/Catalog.php
Binary file not shown.
Binary file modified Retail/metadata/V2/Common.php
Binary file not shown.
17 changes: 9 additions & 8 deletions Retail/metadata/V2/CompletionService.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified Retail/metadata/V2/Model.php
Binary file not shown.
11 changes: 7 additions & 4 deletions Retail/metadata/V2/ProductService.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 18 additions & 3 deletions Retail/metadata/V2/PurgeConfig.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified Retail/metadata/V2/ServingConfig.php
Binary file not shown.
1 change: 1 addition & 0 deletions Retail/samples/V2/PredictionServiceClient/predict.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
* @param string $userEventEventType User event type. Allowed values are:
*
* * `add-to-cart`: Products being added to cart.
* * `remove-from-cart`: Products being removed from cart.
* * `category-page-view`: Special pages such as sale or promotion pages
* viewed.
* * `detail-page-view`: Products detail page viewed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@
use Google\Rpc\Status;

/**
* It is recommended to use the
* We recommend that you use the
* [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
* method instead of
* [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces].
* method instead of the
* [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]
* method.
* [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
* achieves the same results but provides more fine-grained control over
* ingesting local inventory data.
Expand Down
147 changes: 147 additions & 0 deletions Retail/samples/V2/ProductServiceClient/purge_products.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
<?php
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* GENERATED CODE WARNING
* This file was automatically generated - do not edit!
*/

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START retail_v2_generated_ProductService_PurgeProducts_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Retail\V2\Client\ProductServiceClient;
use Google\Cloud\Retail\V2\PurgeProductsRequest;
use Google\Cloud\Retail\V2\PurgeProductsResponse;
use Google\Rpc\Status;

/**
* Permanently deletes all selected [Product][google.cloud.retail.v2.Product]s
* under a branch.
*
* This process is asynchronous. If the request is valid, the removal will be
* enqueued and processed offline. Depending on the number of
* [Product][google.cloud.retail.v2.Product]s, this operation could take hours
* to complete. Before the operation completes, some
* [Product][google.cloud.retail.v2.Product]s may still be returned by
* [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct]
* or
* [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts].
*
* Depending on the number of [Product][google.cloud.retail.v2.Product]s, this
* operation could take hours to complete. To get a sample of
* [Product][google.cloud.retail.v2.Product]s that would be deleted, set
* [PurgeProductsRequest.force][google.cloud.retail.v2.PurgeProductsRequest.force]
* to false.
*
* @param string $formattedParent The resource name of the branch under which the products are
* created. The format is
* `projects/${projectId}/locations/global/catalogs/${catalogId}/branches/${branchId}`
* Please see {@see ProductServiceClient::branchName()} for help formatting this field.
* @param string $filter The filter string to specify the products to be deleted with a
* length limit of 5,000 characters.
*
* Empty string filter is not allowed. "*" implies delete all items in a
* branch.
*
* The eligible fields for filtering are:
*
* * `availability`: Double quoted
* [Product.availability][google.cloud.retail.v2.Product.availability] string.
* * `create_time` : in ISO 8601 "zulu" format.
*
* Supported syntax:
*
* * Comparators (">", "<", ">=", "<=", "=").
* Examples:
* * create_time <= "2015-02-13T17:05:46Z"
* * availability = "IN_STOCK"
*
* * Conjunctions ("AND")
* Examples:
* * create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER"
*
* * Disjunctions ("OR")
* Examples:
* * create_time <= "2015-02-13T17:05:46Z" OR availability = "IN_STOCK"
*
* * Can support nested queries.
* Examples:
* * (create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER")
* OR (create_time >= "2015-02-14T13:03:32Z" AND availability = "IN_STOCK")
*
* * Filter Limits:
* * Filter should not contain more than 6 conditions.
* * Max nesting depth should not exceed 2 levels.
*
* Examples queries:
* * Delete back order products created before a timestamp.
* create_time <= "2015-02-13T17:05:46Z" OR availability = "BACKORDER"
*/
function purge_products_sample(string $formattedParent, string $filter): void
{
// Create a client.
$productServiceClient = new ProductServiceClient();

// Prepare the request message.
$request = (new PurgeProductsRequest())
->setParent($formattedParent)
->setFilter($filter);

// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $productServiceClient->purgeProducts($request);
$response->pollUntilComplete();

if ($response->operationSucceeded()) {
/** @var PurgeProductsResponse $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}

/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = ProductServiceClient::branchName(
'[PROJECT]',
'[LOCATION]',
'[CATALOG]',
'[BRANCH]'
);
$filter = '[FILTER]';

purge_products_sample($formattedParent, $filter);
}
// [END retail_v2_generated_ProductService_PurgeProducts_sync]
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@
use Google\Rpc\Status;

/**
* It is recommended to use the
* We recommend that you use the
* [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
* method instead of
* [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces].
* method instead of the
* [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]
* method.
* [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
* achieves the same results but provides more fine-grained control over
* ingesting local inventory data.
Expand Down
2 changes: 1 addition & 1 deletion Retail/samples/V2/SearchServiceClient/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* or the name of the legacy placement resource, such as
* `projects/&#42;/locations/global/catalogs/default_catalog/placements/default_search`.
* This field is used to identify the serving config name and the set
* of models that will be used to make the search.
* of models that are used to make the search.
* @param string $visitorId 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
* @param string $inputConfigUserEventInlineSourceUserEventsEventType User event type. Allowed values are:
*
* * `add-to-cart`: Products being added to cart.
* * `remove-from-cart`: Products being removed from cart.
* * `category-page-view`: Special pages such as sale or promotion pages
* viewed.
* * `detail-page-view`: Products detail page viewed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
* @param string $userEventEventType User event type. Allowed values are:
*
* * `add-to-cart`: Products being added to cart.
* * `remove-from-cart`: Products being removed from cart.
* * `category-page-view`: Special pages such as sale or promotion pages
* viewed.
* * `detail-page-view`: Products detail page viewed.
Expand Down
Loading

0 comments on commit c5ea1f3

Please sign in to comment.