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

feat: allow users to disable spell check in search requests #449

Merged
merged 2 commits into from Jun 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -618,6 +618,9 @@ public final UnaryCallable<ListProductsRequest, ListProductsResponse> listProduc
* are NOT supported. If not set, all supported fields (the fields that are neither immutable
* nor output only) are updated.
* <p>If an unsupported or unknown field is provided, an INVALID_ARGUMENT error is returned.
* <p>The attribute key can be updated by setting the mask path as "attributes.${key_name}".
* If a key name is present in the mask but not in the patching product from the request, this
* key will be deleted after the update.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Product updateProduct(Product product, FieldMask updateMask) {
Expand Down Expand Up @@ -816,8 +819,7 @@ public final UnaryCallable<DeleteProductRequest, Empty> deleteProductCallable()
/**
* Bulk import of multiple [Product][google.cloud.retail.v2.Product]s.
*
* <p>Request processing may be synchronous. No partial updating is supported. Non-existing items
* are created.
* <p>Request processing may be synchronous. Non-existing items are created.
*
* <p>Note that it is possible for a subset of the [Product][google.cloud.retail.v2.Product]s to
* be successfully updated.
Expand Down Expand Up @@ -854,8 +856,7 @@ public final OperationFuture<ImportProductsResponse, ImportMetadata> importProdu
/**
* Bulk import of multiple [Product][google.cloud.retail.v2.Product]s.
*
* <p>Request processing may be synchronous. No partial updating is supported. Non-existing items
* are created.
* <p>Request processing may be synchronous. Non-existing items are created.
*
* <p>Note that it is possible for a subset of the [Product][google.cloud.retail.v2.Product]s to
* be successfully updated.
Expand Down Expand Up @@ -892,8 +893,7 @@ public final OperationFuture<ImportProductsResponse, ImportMetadata> importProdu
/**
* Bulk import of multiple [Product][google.cloud.retail.v2.Product]s.
*
* <p>Request processing may be synchronous. No partial updating is supported. Non-existing items
* are created.
* <p>Request processing may be synchronous. Non-existing items are created.
*
* <p>Note that it is possible for a subset of the [Product][google.cloud.retail.v2.Product]s to
* be successfully updated.
Expand Down Expand Up @@ -957,8 +957,8 @@ public final UnaryCallable<ImportProductsRequest, Operation> importProductsCalla
*
* <p>Pre-existing inventory information can only be updated with
* [SetInventory][google.cloud.retail.v2.ProductService.SetInventory],
* [AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], and
* [RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces].
* [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces],
* and [RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces].
*
* <p>This feature is only available for users who have Retail Search enabled. Please enable
* Retail Search on Cloud Console before using this feature.
Expand Down Expand Up @@ -1071,8 +1071,8 @@ public final OperationFuture<SetInventoryResponse, SetInventoryMetadata> setInve
*
* <p>Pre-existing inventory information can only be updated with
* [SetInventory][google.cloud.retail.v2.ProductService.SetInventory],
* [AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], and
* [RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces].
* [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces],
* and [RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces].
*
* <p>This feature is only available for users who have Retail Search enabled. Please enable
* Retail Search on Cloud Console before using this feature.
Expand Down Expand Up @@ -1134,8 +1134,8 @@ public final OperationFuture<SetInventoryResponse, SetInventoryMetadata> setInve
*
* <p>Pre-existing inventory information can only be updated with
* [SetInventory][google.cloud.retail.v2.ProductService.SetInventory],
* [AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], and
* [RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces].
* [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces],
* and [RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces].
*
* <p>This feature is only available for users who have Retail Search enabled. Please enable
* Retail Search on Cloud Console before using this feature.
Expand Down Expand Up @@ -1197,8 +1197,8 @@ public final OperationFuture<SetInventoryResponse, SetInventoryMetadata> setInve
*
* <p>Pre-existing inventory information can only be updated with
* [SetInventory][google.cloud.retail.v2.ProductService.SetInventory],
* [AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], and
* [RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces].
* [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces],
* and [RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces].
*
* <p>This feature is only available for users who have Retail Search enabled. Please enable
* Retail Search on Cloud Console before using this feature.
Expand Down
Expand Up @@ -67,6 +67,8 @@
* .addAllVariantRollupKeys(new ArrayList<String>())
* .addAllPageCategories(new ArrayList<String>())
* .setPersonalizationSpec(SearchRequest.PersonalizationSpec.newBuilder().build())
* .putAllLabels(new HashMap<String, String>())
* .setSpellCorrectionSpec(SearchRequest.SpellCorrectionSpec.newBuilder().build())
* .build();
* for (SearchResponse.SearchResult element : searchServiceClient.search(request).iterateAll()) {
* // doThingsWith(element);
Expand Down Expand Up @@ -208,6 +210,8 @@ public SearchServiceStub getStub() {
* .addAllVariantRollupKeys(new ArrayList<String>())
* .addAllPageCategories(new ArrayList<String>())
* .setPersonalizationSpec(SearchRequest.PersonalizationSpec.newBuilder().build())
* .putAllLabels(new HashMap<String, String>())
* .setSpellCorrectionSpec(SearchRequest.SpellCorrectionSpec.newBuilder().build())
* .build();
* for (SearchResponse.SearchResult element : searchServiceClient.search(request).iterateAll()) {
* // doThingsWith(element);
Expand Down Expand Up @@ -256,6 +260,8 @@ public final SearchPagedResponse search(SearchRequest request) {
* .addAllVariantRollupKeys(new ArrayList<String>())
* .addAllPageCategories(new ArrayList<String>())
* .setPersonalizationSpec(SearchRequest.PersonalizationSpec.newBuilder().build())
* .putAllLabels(new HashMap<String, String>())
* .setSpellCorrectionSpec(SearchRequest.SpellCorrectionSpec.newBuilder().build())
* .build();
* ApiFuture<SearchResponse.SearchResult> future =
* searchServiceClient.searchPagedCallable().futureCall(request);
Expand Down Expand Up @@ -304,6 +310,8 @@ public final UnaryCallable<SearchRequest, SearchPagedResponse> searchPagedCallab
* .addAllVariantRollupKeys(new ArrayList<String>())
* .addAllPageCategories(new ArrayList<String>())
* .setPersonalizationSpec(SearchRequest.PersonalizationSpec.newBuilder().build())
* .putAllLabels(new HashMap<String, String>())
* .setSpellCorrectionSpec(SearchRequest.SpellCorrectionSpec.newBuilder().build())
* .build();
* while (true) {
* SearchResponse response = searchServiceClient.searchCallable().call(request);
Expand Down
Expand Up @@ -293,7 +293,7 @@ public final UnaryCallable<CollectUserEventRequest, HttpBody> collectUserEventCa
* try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) {
* PurgeUserEventsRequest request =
* PurgeUserEventsRequest.newBuilder()
* .setParent("parent-995424086")
* .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
* .setFilter("filter-1274492040")
* .setForce(true)
* .build();
Expand Down Expand Up @@ -323,7 +323,7 @@ public final OperationFuture<PurgeUserEventsResponse, PurgeMetadata> purgeUserEv
* try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) {
* PurgeUserEventsRequest request =
* PurgeUserEventsRequest.newBuilder()
* .setParent("parent-995424086")
* .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
* .setFilter("filter-1274492040")
* .setForce(true)
* .build();
Expand Down Expand Up @@ -353,7 +353,7 @@ public final OperationFuture<PurgeUserEventsResponse, PurgeMetadata> purgeUserEv
* try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) {
* PurgeUserEventsRequest request =
* PurgeUserEventsRequest.newBuilder()
* .setParent("parent-995424086")
* .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
* .setFilter("filter-1274492040")
* .setForce(true)
* .build();
Expand Down
Expand Up @@ -139,6 +139,8 @@
* .addAllVariantRollupKeys(new ArrayList<String>())
* .addAllPageCategories(new ArrayList<String>())
* .setPersonalizationSpec(SearchRequest.PersonalizationSpec.newBuilder().build())
* .putAllLabels(new HashMap<String, String>())
* .setSpellCorrectionSpec(SearchRequest.SpellCorrectionSpec.newBuilder().build())
* .build();
* for (SearchResponse.SearchResult element : searchServiceClient.search(request).iterateAll()) {
* // doThingsWith(element);
Expand Down
Expand Up @@ -31,6 +31,7 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
import javax.annotation.Generated;
Expand Down Expand Up @@ -109,6 +110,8 @@ public void searchTest() throws Exception {
.addAllVariantRollupKeys(new ArrayList<String>())
.addAllPageCategories(new ArrayList<String>())
.setPersonalizationSpec(SearchRequest.PersonalizationSpec.newBuilder().build())
.putAllLabels(new HashMap<String, String>())
.setSpellCorrectionSpec(SearchRequest.SpellCorrectionSpec.newBuilder().build())
.build();

SearchPagedResponse pagedListResponse = client.search(request);
Expand Down Expand Up @@ -143,6 +146,8 @@ public void searchTest() throws Exception {
Assert.assertEquals(request.getPageCategoriesList(), actualRequest.getPageCategoriesList());
Assert.assertEquals(request.getSearchMode(), actualRequest.getSearchMode());
Assert.assertEquals(request.getPersonalizationSpec(), actualRequest.getPersonalizationSpec());
Assert.assertEquals(request.getLabelsMap(), actualRequest.getLabelsMap());
Assert.assertEquals(request.getSpellCorrectionSpec(), actualRequest.getSpellCorrectionSpec());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
Expand Down Expand Up @@ -176,6 +181,8 @@ public void searchExceptionTest() throws Exception {
.addAllVariantRollupKeys(new ArrayList<String>())
.addAllPageCategories(new ArrayList<String>())
.setPersonalizationSpec(SearchRequest.PersonalizationSpec.newBuilder().build())
.putAllLabels(new HashMap<String, String>())
.setSpellCorrectionSpec(SearchRequest.SpellCorrectionSpec.newBuilder().build())
.build();
client.search(request);
Assert.fail("No exception raised");
Expand Down
Expand Up @@ -220,7 +220,7 @@ public void purgeUserEventsTest() throws Exception {

PurgeUserEventsRequest request =
PurgeUserEventsRequest.newBuilder()
.setParent("parent-995424086")
.setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
.setFilter("filter-1274492040")
.setForce(true)
.build();
Expand Down Expand Up @@ -249,7 +249,7 @@ public void purgeUserEventsExceptionTest() throws Exception {
try {
PurgeUserEventsRequest request =
PurgeUserEventsRequest.newBuilder()
.setParent("parent-995424086")
.setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
.setFilter("filter-1274492040")
.setForce(true)
.build();
Expand Down
Expand Up @@ -648,7 +648,7 @@ public void deleteProduct(
*
* <pre>
* Bulk import of multiple [Product][google.cloud.retail.v2.Product]s.
* Request processing may be synchronous. No partial updating is supported.
* Request processing may be synchronous.
* Non-existing items are created.
* Note that it is possible for a subset of the
* [Product][google.cloud.retail.v2.Product]s to be successfully updated.
Expand Down Expand Up @@ -694,7 +694,7 @@ public void importProducts(
* then any existing inventory information will be preserved.
* Pre-existing inventory information can only be updated with
* [SetInventory][google.cloud.retail.v2.ProductService.SetInventory],
* [AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces],
* [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces],
* and
* [RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces].
* This feature is only available for users who have Retail Search enabled.
Expand Down Expand Up @@ -993,7 +993,7 @@ public void deleteProduct(
*
* <pre>
* Bulk import of multiple [Product][google.cloud.retail.v2.Product]s.
* Request processing may be synchronous. No partial updating is supported.
* Request processing may be synchronous.
* Non-existing items are created.
* Note that it is possible for a subset of the
* [Product][google.cloud.retail.v2.Product]s to be successfully updated.
Expand Down Expand Up @@ -1041,7 +1041,7 @@ public void importProducts(
* then any existing inventory information will be preserved.
* Pre-existing inventory information can only be updated with
* [SetInventory][google.cloud.retail.v2.ProductService.SetInventory],
* [AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces],
* [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces],
* and
* [RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces].
* This feature is only available for users who have Retail Search enabled.
Expand Down Expand Up @@ -1264,7 +1264,7 @@ public com.google.protobuf.Empty deleteProduct(
*
* <pre>
* Bulk import of multiple [Product][google.cloud.retail.v2.Product]s.
* Request processing may be synchronous. No partial updating is supported.
* Request processing may be synchronous.
* Non-existing items are created.
* Note that it is possible for a subset of the
* [Product][google.cloud.retail.v2.Product]s to be successfully updated.
Expand Down Expand Up @@ -1309,7 +1309,7 @@ public com.google.longrunning.Operation importProducts(
* then any existing inventory information will be preserved.
* Pre-existing inventory information can only be updated with
* [SetInventory][google.cloud.retail.v2.ProductService.SetInventory],
* [AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces],
* [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces],
* and
* [RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces].
* This feature is only available for users who have Retail Search enabled.
Expand Down Expand Up @@ -1518,7 +1518,7 @@ protected ProductServiceFutureStub build(
*
* <pre>
* Bulk import of multiple [Product][google.cloud.retail.v2.Product]s.
* Request processing may be synchronous. No partial updating is supported.
* Request processing may be synchronous.
* Non-existing items are created.
* Note that it is possible for a subset of the
* [Product][google.cloud.retail.v2.Product]s to be successfully updated.
Expand Down Expand Up @@ -1563,7 +1563,7 @@ protected ProductServiceFutureStub build(
* then any existing inventory information will be preserved.
* Pre-existing inventory information can only be updated with
* [SetInventory][google.cloud.retail.v2.ProductService.SetInventory],
* [AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces],
* [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces],
* and
* [RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces].
* This feature is only available for users who have Retail Search enabled.
Expand Down
Expand Up @@ -24,7 +24,8 @@
* <pre>
* Metadata related to the progress of the AddFulfillmentPlaces operation.
* Currently empty because there is no meaningful metadata populated from the
* [AddFulfillmentPlaces][] method.
* [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]
* method.
* </pre>
*
* Protobuf type {@code google.cloud.retail.v2.AddFulfillmentPlacesMetadata}
Expand Down Expand Up @@ -263,7 +264,8 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build
* <pre>
* Metadata related to the progress of the AddFulfillmentPlaces operation.
* Currently empty because there is no meaningful metadata populated from the
* [AddFulfillmentPlaces][] method.
* [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]
* method.
* </pre>
*
* Protobuf type {@code google.cloud.retail.v2.AddFulfillmentPlacesMetadata}
Expand Down
Expand Up @@ -22,7 +22,9 @@
*
*
* <pre>
* Request message for [AddFulfillmentPlaces][] method.
* Request message for
* [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]
* method.
* </pre>
*
* Protobuf type {@code google.cloud.retail.v2.AddFulfillmentPlacesRequest}
Expand Down Expand Up @@ -692,7 +694,9 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build
*
*
* <pre>
* Request message for [AddFulfillmentPlaces][] method.
* Request message for
* [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]
* method.
* </pre>
*
* Protobuf type {@code google.cloud.retail.v2.AddFulfillmentPlacesRequest}
Expand Down
Expand Up @@ -23,7 +23,8 @@
*
* <pre>
* Response of the AddFulfillmentPlacesRequest. Currently empty because
* there is no meaningful response populated from the [AddFulfillmentPlaces][]
* there is no meaningful response populated from the
* [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]
* method.
* </pre>
*
Expand Down Expand Up @@ -262,7 +263,8 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build
*
* <pre>
* Response of the AddFulfillmentPlacesRequest. Currently empty because
* there is no meaningful response populated from the [AddFulfillmentPlaces][]
* there is no meaningful response populated from the
* [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]
* method.
* </pre>
*
Expand Down