diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml
index 13e732dd2..fce568dc2 100644
--- a/.github/sync-repo-settings.yaml
+++ b/.github/sync-repo-settings.yaml
@@ -186,40 +186,6 @@ branchProtectionRules:
- 'Kokoro - Test: Java GraalVM Native Image'
- 'Kokoro - Test: Java 17 GraalVM Native Image'
- javadoc
- - pattern: grpc-experimental
- isAdminEnforced: true
- requiredApprovingReviewCount: 1
- requiresCodeOwnerReviews: true
- requiresStrictStatusChecks: false
- requiredStatusCheckContexts:
- - dependencies (17)
- - lint
- - clirr
- - units (8)
- - units (11)
- - 'Kokoro - Test: Integration'
- - cla/google
- - OwlBot Post Processor
- - 'Kokoro - Test: Java GraalVM Native Image'
- - 'Kokoro - Test: Java 17 GraalVM Native Image'
- - javadoc
- - pattern: grpc-experimental
- isAdminEnforced: true
- requiredApprovingReviewCount: 1
- requiresCodeOwnerReviews: true
- requiresStrictStatusChecks: false
- requiredStatusCheckContexts:
- - dependencies (17)
- - lint
- - clirr
- - units (8)
- - units (11)
- - 'Kokoro - Test: Integration'
- - cla/google
- - OwlBot Post Processor
- - 'Kokoro - Test: Java GraalVM Native Image'
- - 'Kokoro - Test: Java 17 GraalVM Native Image'
- - javadoc
permissionRules:
- team: yoshi-admins
permission: admin
diff --git a/.github/workflows/hermetic_library_generation.yaml b/.github/workflows/hermetic_library_generation.yaml
index 4caa5567a..46b80edc1 100644
--- a/.github/workflows/hermetic_library_generation.yaml
+++ b/.github/workflows/hermetic_library_generation.yaml
@@ -37,7 +37,7 @@ jobs:
with:
fetch-depth: 0
token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}
- - uses: googleapis/sdk-platform-java/.github/scripts@v2.46.0
+ - uses: googleapis/sdk-platform-java/.github/scripts@v2.49.0
if: env.SHOULD_RUN == 'true'
with:
base_ref: ${{ github.base_ref }}
diff --git a/.github/workflows/unmanaged_dependency_check.yaml b/.github/workflows/unmanaged_dependency_check.yaml
index aabf59292..f1796d286 100644
--- a/.github/workflows/unmanaged_dependency_check.yaml
+++ b/.github/workflows/unmanaged_dependency_check.yaml
@@ -14,6 +14,6 @@ jobs:
shell: bash
run: .kokoro/build.sh
- name: Unmanaged dependency check
- uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.36.1
+ uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.39.0
with:
bom-path: google-cloud-datastore-bom/pom.xml
diff --git a/.kokoro/presubmit/graalvm-native-17.cfg b/.kokoro/presubmit/graalvm-native-17.cfg
index b39cf017d..e8c154f48 100644
--- a/.kokoro/presubmit/graalvm-native-17.cfg
+++ b/.kokoro/presubmit/graalvm-native-17.cfg
@@ -3,7 +3,7 @@
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
- value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.36.1"
+ value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.39.0"
}
env_vars: {
diff --git a/.kokoro/presubmit/graalvm-native.cfg b/.kokoro/presubmit/graalvm-native.cfg
index c59887969..046dc8df4 100644
--- a/.kokoro/presubmit/graalvm-native.cfg
+++ b/.kokoro/presubmit/graalvm-native.cfg
@@ -3,7 +3,7 @@
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
- value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.36.1"
+ value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.39.0"
}
env_vars: {
diff --git a/.readme-partials.yaml b/.readme-partials.yaml
index c999cf6b5..965a0bdd0 100644
--- a/.readme-partials.yaml
+++ b/.readme-partials.yaml
@@ -185,6 +185,103 @@ custom_content: |
To customize the number of channels your client uses, you can update the channel provider in the DatastoreOptions.
See [ChannelPoolSettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.grpc.ChannelPoolSettings) and [Performance Best Practices](https://grpc.io/docs/guides/performance/) for more information on channel pools and best practices for performance.
+ Example:
+ ```java
+ InstantiatingGrpcChannelProvider channelProvider =
+ DatastoreSettings.defaultGrpcTransportProviderBuilder()
+ .setChannelPoolSettings(
+ ChannelPoolSettings.builder()
+ .setInitialChannelCount(MIN_VAL)
+ .setMaxChannelCount(MAX_VAL)
+ .build())
+ .build();
+
+ DatastoreOptions options = DatastoreOptions.newBuilder()
+ .setProjectId("my-project")
+ .setChannelProvider(channelProvider)
+ .setTransportOptions(GrpcTransportOptions.newBuilder().build())
+ .build();
+ ```
+
+ gRPC Java Datastore Client User Guide
+ -------
+ In this feature launch, the [Java Datastore client](https://github.com/googleapis/java-datastore) now offers gRPC as a transport layer option with experimental support. Using [gRPC connection pooling](https://grpc.io/docs/guides/performance/) enables distributing RPCs over multiple connections which may improve performance.
+
+ #### Download Instructions
+ Instructions:
+ 1. Clone the grpc-experimental branch from GitHub:
+ ```python
+ git clone -b grpc-experimental https://github.com/googleapis/java-datastore.git
+ ```
+ 2. Run the following commands to build the library:
+ ```python
+ # Go to the directory the code was downloaded to
+ cd java-datastore/
+
+ # Build the library
+ mvn clean install -DskipTests=true
+ ```
+ 3. Add the following dependency to your project:
+ ```xml
+
If an entity for {@code entity.getKey()} does not exists, {@code entity} is inserted. + *
If an entity for {@code entity.getKey()} does not exist, {@code entity} is inserted.
* Otherwise, {@link #submit()} will throw a {@link DatastoreException} with {@link
* DatastoreException#getReason()} equal to {@code "ALREADY_EXISTS"}.
+ *
+ * @param entity the entity to be added to the datastore
+ * @return The entity that was added
+ * @throws DatastoreException if there was any failure
*/
@Override
Entity add(FullEntity> entity);
@@ -69,6 +73,10 @@ interface Response {
* exists, {@link #submit()} will throw a {@link DatastoreException} with {@link
* DatastoreException#getReason()} equal to {@code "ALREADY_EXISTS"}. All entities in {@code
* entities} whose key did not exist are inserted.
+ *
+ * @param entities entities to be added to the datastore
+ * @return A list of entities that have been added
+ * @throws DatastoreException if there was any failure
*/
@Override
List Note: close() needs to be called on the DatastoreClient object to clean up resources such as
* threads. In the example above, try-with-resources is used, which automatically calls close().
*
- * The surface of this class includes several types of Java methods for each of the API's
- * methods:
- *
- * Lookup Looks up entities by key. Request object method variants only take one parameter, a request object, which must be constructed before the call. lookup(LookupRequest request)
+ * "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. lookup(String projectId, ReadOptions readOptions, List<Key> keys)
+ * Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. lookupCallable()
+ * RunQuery Queries for entities. Request object method variants only take one parameter, a request object, which must be constructed before the call. runQuery(RunQueryRequest request)
+ * Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. runQueryCallable()
+ * RunAggregationQuery Runs an aggregation query. Request object method variants only take one parameter, a request object, which must be constructed before the call. runAggregationQuery(RunAggregationQueryRequest request)
+ * Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. runAggregationQueryCallable()
+ * BeginTransaction Begins a new transaction. Request object method variants only take one parameter, a request object, which must be constructed before the call. beginTransaction(BeginTransactionRequest request)
+ * "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. beginTransaction(String projectId)
+ * Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. beginTransactionCallable()
+ * Commit Commits a transaction, optionally creating, deleting or modifying some entities. Request object method variants only take one parameter, a request object, which must be constructed before the call. commit(CommitRequest request)
+ * "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. commit(String projectId, CommitRequest.Mode mode, List<Mutation> mutations)
+ * commit(String projectId, CommitRequest.Mode mode, ByteString transaction, List<Mutation> mutations)
+ * Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. commitCallable()
+ * Rollback Rolls back a transaction. Request object method variants only take one parameter, a request object, which must be constructed before the call. rollback(RollbackRequest request)
+ * "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. rollback(String projectId, ByteString transaction)
+ * Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. rollbackCallable()
+ * AllocateIds Allocates IDs for the given keys, which is useful for referencing an entity before it is inserted. Request object method variants only take one parameter, a request object, which must be constructed before the call. allocateIds(AllocateIdsRequest request)
+ * "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. allocateIds(String projectId, List<Key> keys)
+ * Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. allocateIdsCallable()
+ * ReserveIds Prevents the supplied keys' IDs from being auto-allocated by Cloud Datastore. Request object method variants only take one parameter, a request object, which must be constructed before the call. reserveIds(ReserveIdsRequest request)
+ * "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. reserveIds(String projectId, List<Key> keys)
+ * Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. reserveIdsCallable()
+ * See the individual methods for example code.
*
@@ -241,6 +373,7 @@ public final LookupResponse lookup(String projectId, ReadOptions readOptions, Li
* .setDatabaseId("databaseId1688905718")
* .setReadOptions(ReadOptions.newBuilder().build())
* .addAllKeys(new ArrayList The builder of this class is recursive, so contained classes are themselves builders. When
* build() is called, the tree of builders is called to create the complete settings object.
*
- * For example, to set the total timeout of lookup to 30 seconds:
+ * For example, to set the
+ * [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings)
+ * of lookup:
*
* The builder of this class is recursive, so contained classes are themselves builders. When
* build() is called, the tree of builders is called to create the complete settings object.
*
- * For example, to set the total timeout of lookup to 30 seconds:
+ * For example, to set the
+ * [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings)
+ * of lookup:
*
* This class is for advanced usage.
*/
@Generated("by gapic-generator-java")
-@BetaApi
public class HttpJsonDatastoreCallableFactory
implements HttpJsonStubCallableFactory This class is for advanced usage and reflects the underlying API directly.
*/
@Generated("by gapic-generator-java")
-@BetaApi
public class HttpJsonDatastoreStub extends DatastoreStub {
private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build();
diff --git a/google-cloud-datastore/src/main/resources/META-INF/native-image/com.google.cloud.datastore.admin.v1/reflect-config.json b/google-cloud-datastore/src/main/resources/META-INF/native-image/com.google.cloud.datastore.admin.v1/reflect-config.json
index e4ca7ae5f..dfe000730 100644
--- a/google-cloud-datastore/src/main/resources/META-INF/native-image/com.google.cloud.datastore.admin.v1/reflect-config.json
+++ b/google-cloud-datastore/src/main/resources/META-INF/native-image/com.google.cloud.datastore.admin.v1/reflect-config.json
@@ -395,6 +395,24 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.api.SelectiveGapicGeneration",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.api.SelectiveGapicGeneration$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.datastore.admin.v1.CommonMetadata",
"queryAllDeclaredConstructors": true,
diff --git a/google-cloud-datastore/src/main/resources/META-INF/native-image/com.google.cloud.datastore.v1/reflect-config.json b/google-cloud-datastore/src/main/resources/META-INF/native-image/com.google.cloud.datastore.v1/reflect-config.json
index b0a64366e..475f7690c 100644
--- a/google-cloud-datastore/src/main/resources/META-INF/native-image/com.google.cloud.datastore.v1/reflect-config.json
+++ b/google-cloud-datastore/src/main/resources/META-INF/native-image/com.google.cloud.datastore.v1/reflect-config.json
@@ -305,6 +305,24 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.api.PythonSettings$ExperimentalFeatures",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.api.PythonSettings$ExperimentalFeatures$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.api.ResourceDescriptor",
"queryAllDeclaredConstructors": true,
@@ -413,6 +431,24 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.api.SelectiveGapicGeneration",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.api.SelectiveGapicGeneration$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.datastore.v1.AggregationQuery",
"queryAllDeclaredConstructors": true,
@@ -746,6 +782,60 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.datastore.v1.ExecutionStats",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.datastore.v1.ExecutionStats$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.datastore.v1.ExplainMetrics",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.datastore.v1.ExplainMetrics$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.datastore.v1.ExplainOptions",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.datastore.v1.ExplainOptions$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.datastore.v1.Filter",
"queryAllDeclaredConstructors": true,
@@ -764,6 +854,33 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.datastore.v1.FindNearest",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.datastore.v1.FindNearest$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.datastore.v1.FindNearest$DistanceMeasure",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.datastore.v1.GqlQuery",
"queryAllDeclaredConstructors": true,
@@ -908,6 +1025,15 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.datastore.v1.Mutation$ConflictResolutionStrategy",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.datastore.v1.MutationResult",
"queryAllDeclaredConstructors": true,
@@ -944,6 +1070,24 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.datastore.v1.PlanSummary",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.datastore.v1.PlanSummary$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.datastore.v1.Projection",
"queryAllDeclaredConstructors": true,
@@ -989,6 +1133,24 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.datastore.v1.PropertyMask",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.datastore.v1.PropertyMask$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.datastore.v1.PropertyOrder",
"queryAllDeclaredConstructors": true,
@@ -1034,6 +1196,33 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.datastore.v1.PropertyTransform",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.datastore.v1.PropertyTransform$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.datastore.v1.PropertyTransform$ServerValue",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.datastore.v1.Query",
"queryAllDeclaredConstructors": true,
@@ -1412,6 +1601,15 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.protobuf.DescriptorProtos$Edition",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.protobuf.DescriptorProtos$EnumDescriptorProto",
"queryAllDeclaredConstructors": true,
@@ -1547,6 +1745,114 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.protobuf.DescriptorProtos$FeatureSet",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.protobuf.DescriptorProtos$FeatureSet$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.protobuf.DescriptorProtos$FeatureSet$EnumType",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.protobuf.DescriptorProtos$FeatureSet$FieldPresence",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.protobuf.DescriptorProtos$FeatureSet$JsonFormat",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.protobuf.DescriptorProtos$FeatureSet$MessageEncoding",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.protobuf.DescriptorProtos$FeatureSet$RepeatedFieldEncoding",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.protobuf.DescriptorProtos$FeatureSet$Utf8Validation",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.protobuf.DescriptorProtos$FeatureSetDefaults",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.protobuf.DescriptorProtos$FeatureSetDefaults$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.protobuf.DescriptorProtos$FeatureSetDefaults$FeatureSetEditionDefault",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.protobuf.DescriptorProtos$FeatureSetDefaults$FeatureSetEditionDefault$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.protobuf.DescriptorProtos$FieldDescriptorProto",
"queryAllDeclaredConstructors": true,
@@ -1610,6 +1916,24 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.protobuf.DescriptorProtos$FieldOptions$EditionDefault",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.protobuf.DescriptorProtos$FieldOptions$EditionDefault$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.protobuf.DescriptorProtos$FieldOptions$JSType",
"queryAllDeclaredConstructors": true,
diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/DatastoreClientHttpJsonTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/DatastoreClientHttpJsonTest.java
index fa3a2a4e9..541f3b603 100644
--- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/DatastoreClientHttpJsonTest.java
+++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/DatastoreClientHttpJsonTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2023 Google LLC
+ * 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.
@@ -33,11 +33,14 @@
import com.google.datastore.v1.CommitRequest;
import com.google.datastore.v1.CommitResponse;
import com.google.datastore.v1.EntityResult;
+import com.google.datastore.v1.ExplainMetrics;
+import com.google.datastore.v1.ExplainOptions;
import com.google.datastore.v1.Key;
import com.google.datastore.v1.LookupResponse;
import com.google.datastore.v1.Mutation;
import com.google.datastore.v1.MutationResult;
import com.google.datastore.v1.PartitionId;
+import com.google.datastore.v1.PropertyMask;
import com.google.datastore.v1.Query;
import com.google.datastore.v1.QueryResultBatch;
import com.google.datastore.v1.ReadOptions;
@@ -153,6 +156,7 @@ public void runQueryTest() throws Exception {
.setBatch(QueryResultBatch.newBuilder().build())
.setQuery(Query.newBuilder().build())
.setTransaction(ByteString.EMPTY)
+ .setExplainMetrics(ExplainMetrics.newBuilder().build())
.build();
mockService.addResponse(expectedResponse);
@@ -162,6 +166,8 @@ public void runQueryTest() throws Exception {
.setDatabaseId("databaseId1688905718")
.setPartitionId(PartitionId.newBuilder().build())
.setReadOptions(ReadOptions.newBuilder().build())
+ .setPropertyMask(PropertyMask.newBuilder().build())
+ .setExplainOptions(ExplainOptions.newBuilder().build())
.build();
RunQueryResponse actualResponse = client.runQuery(request);
@@ -196,6 +202,8 @@ public void runQueryExceptionTest() throws Exception {
.setDatabaseId("databaseId1688905718")
.setPartitionId(PartitionId.newBuilder().build())
.setReadOptions(ReadOptions.newBuilder().build())
+ .setPropertyMask(PropertyMask.newBuilder().build())
+ .setExplainOptions(ExplainOptions.newBuilder().build())
.build();
client.runQuery(request);
Assert.fail("No exception raised");
@@ -211,6 +219,7 @@ public void runAggregationQueryTest() throws Exception {
.setBatch(AggregationResultBatch.newBuilder().build())
.setQuery(AggregationQuery.newBuilder().build())
.setTransaction(ByteString.EMPTY)
+ .setExplainMetrics(ExplainMetrics.newBuilder().build())
.build();
mockService.addResponse(expectedResponse);
@@ -220,6 +229,7 @@ public void runAggregationQueryTest() throws Exception {
.setDatabaseId("databaseId1688905718")
.setPartitionId(PartitionId.newBuilder().build())
.setReadOptions(ReadOptions.newBuilder().build())
+ .setExplainOptions(ExplainOptions.newBuilder().build())
.build();
RunAggregationQueryResponse actualResponse = client.runAggregationQuery(request);
@@ -254,6 +264,7 @@ public void runAggregationQueryExceptionTest() throws Exception {
.setDatabaseId("databaseId1688905718")
.setPartitionId(PartitionId.newBuilder().build())
.setReadOptions(ReadOptions.newBuilder().build())
+ .setExplainOptions(ExplainOptions.newBuilder().build())
.build();
client.runAggregationQuery(request);
Assert.fail("No exception raised");
diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/DatastoreClientTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/DatastoreClientTest.java
index 663de9fb0..1dc96c5d1 100644
--- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/DatastoreClientTest.java
+++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/DatastoreClientTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2023 Google LLC
+ * 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.
@@ -32,12 +32,15 @@
import com.google.datastore.v1.CommitRequest;
import com.google.datastore.v1.CommitResponse;
import com.google.datastore.v1.EntityResult;
+import com.google.datastore.v1.ExplainMetrics;
+import com.google.datastore.v1.ExplainOptions;
import com.google.datastore.v1.Key;
import com.google.datastore.v1.LookupRequest;
import com.google.datastore.v1.LookupResponse;
import com.google.datastore.v1.Mutation;
import com.google.datastore.v1.MutationResult;
import com.google.datastore.v1.PartitionId;
+import com.google.datastore.v1.PropertyMask;
import com.google.datastore.v1.Query;
import com.google.datastore.v1.QueryResultBatch;
import com.google.datastore.v1.ReadOptions;
@@ -159,6 +162,7 @@ public void runQueryTest() throws Exception {
.setBatch(QueryResultBatch.newBuilder().build())
.setQuery(Query.newBuilder().build())
.setTransaction(ByteString.EMPTY)
+ .setExplainMetrics(ExplainMetrics.newBuilder().build())
.build();
mockDatastore.addResponse(expectedResponse);
@@ -168,6 +172,8 @@ public void runQueryTest() throws Exception {
.setDatabaseId("databaseId1688905718")
.setPartitionId(PartitionId.newBuilder().build())
.setReadOptions(ReadOptions.newBuilder().build())
+ .setPropertyMask(PropertyMask.newBuilder().build())
+ .setExplainOptions(ExplainOptions.newBuilder().build())
.build();
RunQueryResponse actualResponse = client.runQuery(request);
@@ -183,6 +189,8 @@ public void runQueryTest() throws Exception {
Assert.assertEquals(request.getReadOptions(), actualRequest.getReadOptions());
Assert.assertEquals(request.getQuery(), actualRequest.getQuery());
Assert.assertEquals(request.getGqlQuery(), actualRequest.getGqlQuery());
+ Assert.assertEquals(request.getPropertyMask(), actualRequest.getPropertyMask());
+ Assert.assertEquals(request.getExplainOptions(), actualRequest.getExplainOptions());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
@@ -201,6 +209,8 @@ public void runQueryExceptionTest() throws Exception {
.setDatabaseId("databaseId1688905718")
.setPartitionId(PartitionId.newBuilder().build())
.setReadOptions(ReadOptions.newBuilder().build())
+ .setPropertyMask(PropertyMask.newBuilder().build())
+ .setExplainOptions(ExplainOptions.newBuilder().build())
.build();
client.runQuery(request);
Assert.fail("No exception raised");
@@ -216,6 +226,7 @@ public void runAggregationQueryTest() throws Exception {
.setBatch(AggregationResultBatch.newBuilder().build())
.setQuery(AggregationQuery.newBuilder().build())
.setTransaction(ByteString.EMPTY)
+ .setExplainMetrics(ExplainMetrics.newBuilder().build())
.build();
mockDatastore.addResponse(expectedResponse);
@@ -225,6 +236,7 @@ public void runAggregationQueryTest() throws Exception {
.setDatabaseId("databaseId1688905718")
.setPartitionId(PartitionId.newBuilder().build())
.setReadOptions(ReadOptions.newBuilder().build())
+ .setExplainOptions(ExplainOptions.newBuilder().build())
.build();
RunAggregationQueryResponse actualResponse = client.runAggregationQuery(request);
@@ -240,6 +252,7 @@ public void runAggregationQueryTest() throws Exception {
Assert.assertEquals(request.getReadOptions(), actualRequest.getReadOptions());
Assert.assertEquals(request.getAggregationQuery(), actualRequest.getAggregationQuery());
Assert.assertEquals(request.getGqlQuery(), actualRequest.getGqlQuery());
+ Assert.assertEquals(request.getExplainOptions(), actualRequest.getExplainOptions());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
@@ -258,6 +271,7 @@ public void runAggregationQueryExceptionTest() throws Exception {
.setDatabaseId("databaseId1688905718")
.setPartitionId(PartitionId.newBuilder().build())
.setReadOptions(ReadOptions.newBuilder().build())
+ .setExplainOptions(ExplainOptions.newBuilder().build())
.build();
client.runAggregationQuery(request);
Assert.fail("No exception raised");
diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/MockDatastore.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/MockDatastore.java
index d2295784c..ecdbcd2e9 100644
--- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/MockDatastore.java
+++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/MockDatastore.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2023 Google LLC
+ * 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.
diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/MockDatastoreImpl.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/MockDatastoreImpl.java
index 3b3d8b937..c7e0ded1f 100644
--- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/MockDatastoreImpl.java
+++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/MockDatastoreImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2023 Google LLC
+ * 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.
diff --git a/grpc-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/DatastoreGrpc.java b/grpc-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/DatastoreGrpc.java
index b3dc940b7..d10d42190 100644
--- a/grpc-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/DatastoreGrpc.java
+++ b/grpc-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/DatastoreGrpc.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2023 Google LLC
+ * 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.
diff --git a/pom.xml b/pom.xml
index e5ad86dbe..1b19ec4fb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,7 +14,7 @@
- *
+ *
+ *
*
*
+ *
+ * Method
+ * Description
+ * Method Variants
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * {@code
* // This snippet has been automatically generated and should be regarded as a code template only.
@@ -79,10 +81,21 @@
* .lookupSettings()
* .getRetrySettings()
* .toBuilder()
- * .setTotalTimeout(Duration.ofSeconds(30))
+ * .setInitialRetryDelayDuration(Duration.ofSeconds(1))
+ * .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
+ * .setMaxAttempts(5)
+ * .setMaxRetryDelayDuration(Duration.ofSeconds(30))
+ * .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
+ * .setRetryDelayMultiplier(1.3)
+ * .setRpcTimeoutMultiplier(1.5)
+ * .setTotalTimeoutDuration(Duration.ofSeconds(300))
* .build());
* DatastoreSettings datastoreSettings = datastoreSettingsBuilder.build();
* }
+ *
+ * Please refer to the [Client Side Retry
+ * Guide](https://github.com/googleapis/google-cloud-java/blob/main/docs/client_retries.md) for
+ * additional support in setting retries.
*/
@Generated("by gapic-generator-java")
public class DatastoreSettings extends ClientSettings{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
@@ -90,10 +93,21 @@
* .lookupSettings()
* .getRetrySettings()
* .toBuilder()
- * .setTotalTimeout(Duration.ofSeconds(30))
+ * .setInitialRetryDelayDuration(Duration.ofSeconds(1))
+ * .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
+ * .setMaxAttempts(5)
+ * .setMaxRetryDelayDuration(Duration.ofSeconds(30))
+ * .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
+ * .setRetryDelayMultiplier(1.3)
+ * .setRpcTimeoutMultiplier(1.5)
+ * .setTotalTimeoutDuration(Duration.ofSeconds(300))
* .build());
* DatastoreStubSettings datastoreSettings = datastoreSettingsBuilder.build();
* }
+ *
+ * Please refer to the [Client Side Retry
+ * Guide](https://github.com/googleapis/google-cloud-java/blob/main/docs/client_retries.md) for
+ * additional support in setting retries.
*/
@Generated("by gapic-generator-java")
public class DatastoreStubSettings extends StubSettings
+ * Nearest Neighbors search config. The ordering provided by FindNearest
+ * supersedes the order_by stage. If multiple documents have the same vector
+ * distance, the returned document order is not guaranteed to be stable between
+ * queries.
+ *
+ *
+ * Protobuf type {@code google.datastore.v1.FindNearest}
+ */
+public final class FindNearest extends com.google.protobuf.GeneratedMessageV3
+ implements
+ // @@protoc_insertion_point(message_implements:google.datastore.v1.FindNearest)
+ FindNearestOrBuilder {
+ private static final long serialVersionUID = 0L;
+ // Use FindNearest.newBuilder() to construct.
+ private FindNearest(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
+ super(builder);
+ }
+
+ private FindNearest() {
+ distanceMeasure_ = 0;
+ distanceResultProperty_ = "";
+ }
+
+ @java.lang.Override
+ @SuppressWarnings({"unused"})
+ protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
+ return new FindNearest();
+ }
+
+ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
+ return com.google.datastore.v1.QueryProto
+ .internal_static_google_datastore_v1_FindNearest_descriptor;
+ }
+
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return com.google.datastore.v1.QueryProto
+ .internal_static_google_datastore_v1_FindNearest_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ com.google.datastore.v1.FindNearest.class,
+ com.google.datastore.v1.FindNearest.Builder.class);
+ }
+
+ /**
+ *
+ *
+ *
+ * The distance measure to use when comparing vectors.
+ *
+ *
+ * Protobuf enum {@code google.datastore.v1.FindNearest.DistanceMeasure}
+ */
+ public enum DistanceMeasure implements com.google.protobuf.ProtocolMessageEnum {
+ /**
+ *
+ *
+ *
+ * Should not be set.
+ *
+ *
+ * DISTANCE_MEASURE_UNSPECIFIED = 0;
+ */
+ DISTANCE_MEASURE_UNSPECIFIED(0),
+ /**
+ *
+ *
+ *
+ * Measures the EUCLIDEAN distance between the vectors. See
+ * [Euclidean](https://en.wikipedia.org/wiki/Euclidean_distance) to learn
+ * more. The resulting distance decreases the more similar two vectors are.
+ *
+ *
+ * EUCLIDEAN = 1;
+ */
+ EUCLIDEAN(1),
+ /**
+ *
+ *
+ *
+ * COSINE distance compares vectors based on the angle between them, which
+ * allows you to measure similarity that isn't based on the vectors
+ * magnitude. We recommend using DOT_PRODUCT with unit normalized vectors
+ * instead of COSINE distance, which is mathematically equivalent with
+ * better performance. See [Cosine
+ * Similarity](https://en.wikipedia.org/wiki/Cosine_similarity) to learn
+ * more about COSINE similarity and COSINE distance. The resulting COSINE
+ * distance decreases the more similar two vectors are.
+ *
+ *
+ * COSINE = 2;
+ */
+ COSINE(2),
+ /**
+ *
+ *
+ *
+ * Similar to cosine but is affected by the magnitude of the vectors. See
+ * [Dot Product](https://en.wikipedia.org/wiki/Dot_product) to learn more.
+ * The resulting distance increases the more similar two vectors are.
+ *
+ *
+ * DOT_PRODUCT = 3;
+ */
+ DOT_PRODUCT(3),
+ UNRECOGNIZED(-1),
+ ;
+
+ /**
+ *
+ *
+ *
+ * Should not be set.
+ *
+ *
+ * DISTANCE_MEASURE_UNSPECIFIED = 0;
+ */
+ public static final int DISTANCE_MEASURE_UNSPECIFIED_VALUE = 0;
+ /**
+ *
+ *
+ *
+ * Measures the EUCLIDEAN distance between the vectors. See
+ * [Euclidean](https://en.wikipedia.org/wiki/Euclidean_distance) to learn
+ * more. The resulting distance decreases the more similar two vectors are.
+ *
+ *
+ * EUCLIDEAN = 1;
+ */
+ public static final int EUCLIDEAN_VALUE = 1;
+ /**
+ *
+ *
+ *
+ * COSINE distance compares vectors based on the angle between them, which
+ * allows you to measure similarity that isn't based on the vectors
+ * magnitude. We recommend using DOT_PRODUCT with unit normalized vectors
+ * instead of COSINE distance, which is mathematically equivalent with
+ * better performance. See [Cosine
+ * Similarity](https://en.wikipedia.org/wiki/Cosine_similarity) to learn
+ * more about COSINE similarity and COSINE distance. The resulting COSINE
+ * distance decreases the more similar two vectors are.
+ *
+ *
+ * COSINE = 2;
+ */
+ public static final int COSINE_VALUE = 2;
+ /**
+ *
+ *
+ *
+ * Similar to cosine but is affected by the magnitude of the vectors. See
+ * [Dot Product](https://en.wikipedia.org/wiki/Dot_product) to learn more.
+ * The resulting distance increases the more similar two vectors are.
+ *
+ *
+ * DOT_PRODUCT = 3;
+ */
+ public static final int DOT_PRODUCT_VALUE = 3;
+
+ public final int getNumber() {
+ if (this == UNRECOGNIZED) {
+ throw new java.lang.IllegalArgumentException(
+ "Can't get the number of an unknown enum value.");
+ }
+ return value;
+ }
+
+ /**
+ * @param value The numeric wire value of the corresponding enum entry.
+ * @return The enum associated with the given numeric wire value.
+ * @deprecated Use {@link #forNumber(int)} instead.
+ */
+ @java.lang.Deprecated
+ public static DistanceMeasure valueOf(int value) {
+ return forNumber(value);
+ }
+
+ /**
+ * @param value The numeric wire value of the corresponding enum entry.
+ * @return The enum associated with the given numeric wire value.
+ */
+ public static DistanceMeasure forNumber(int value) {
+ switch (value) {
+ case 0:
+ return DISTANCE_MEASURE_UNSPECIFIED;
+ case 1:
+ return EUCLIDEAN;
+ case 2:
+ return COSINE;
+ case 3:
+ return DOT_PRODUCT;
+ default:
+ return null;
+ }
+ }
+
+ public static com.google.protobuf.Internal.EnumLiteMap
+ * Required. An indexed vector property to search upon. Only documents which
+ * contain vectors whose dimensionality match the query_vector can be
+ * returned.
+ *
+ *
+ *
+ * .google.datastore.v1.PropertyReference vector_property = 1 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return Whether the vectorProperty field is set.
+ */
+ @java.lang.Override
+ public boolean hasVectorProperty() {
+ return ((bitField0_ & 0x00000001) != 0);
+ }
+ /**
+ *
+ *
+ *
+ * Required. An indexed vector property to search upon. Only documents which
+ * contain vectors whose dimensionality match the query_vector can be
+ * returned.
+ *
+ *
+ *
+ * .google.datastore.v1.PropertyReference vector_property = 1 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return The vectorProperty.
+ */
+ @java.lang.Override
+ public com.google.datastore.v1.PropertyReference getVectorProperty() {
+ return vectorProperty_ == null
+ ? com.google.datastore.v1.PropertyReference.getDefaultInstance()
+ : vectorProperty_;
+ }
+ /**
+ *
+ *
+ *
+ * Required. An indexed vector property to search upon. Only documents which
+ * contain vectors whose dimensionality match the query_vector can be
+ * returned.
+ *
+ *
+ *
+ * .google.datastore.v1.PropertyReference vector_property = 1 [(.google.api.field_behavior) = REQUIRED];
+ *
+ */
+ @java.lang.Override
+ public com.google.datastore.v1.PropertyReferenceOrBuilder getVectorPropertyOrBuilder() {
+ return vectorProperty_ == null
+ ? com.google.datastore.v1.PropertyReference.getDefaultInstance()
+ : vectorProperty_;
+ }
+
+ public static final int QUERY_VECTOR_FIELD_NUMBER = 2;
+ private com.google.datastore.v1.Value queryVector_;
+ /**
+ *
+ *
+ *
+ * Required. The query vector that we are searching on. Must be a vector of no
+ * more than 2048 dimensions.
+ *
+ *
+ * .google.datastore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return Whether the queryVector field is set.
+ */
+ @java.lang.Override
+ public boolean hasQueryVector() {
+ return ((bitField0_ & 0x00000002) != 0);
+ }
+ /**
+ *
+ *
+ *
+ * Required. The query vector that we are searching on. Must be a vector of no
+ * more than 2048 dimensions.
+ *
+ *
+ * .google.datastore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return The queryVector.
+ */
+ @java.lang.Override
+ public com.google.datastore.v1.Value getQueryVector() {
+ return queryVector_ == null ? com.google.datastore.v1.Value.getDefaultInstance() : queryVector_;
+ }
+ /**
+ *
+ *
+ *
+ * Required. The query vector that we are searching on. Must be a vector of no
+ * more than 2048 dimensions.
+ *
+ *
+ * .google.datastore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ */
+ @java.lang.Override
+ public com.google.datastore.v1.ValueOrBuilder getQueryVectorOrBuilder() {
+ return queryVector_ == null ? com.google.datastore.v1.Value.getDefaultInstance() : queryVector_;
+ }
+
+ public static final int DISTANCE_MEASURE_FIELD_NUMBER = 3;
+ private int distanceMeasure_ = 0;
+ /**
+ *
+ *
+ *
+ * Required. The Distance Measure to use, required.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return The enum numeric value on the wire for distanceMeasure.
+ */
+ @java.lang.Override
+ public int getDistanceMeasureValue() {
+ return distanceMeasure_;
+ }
+ /**
+ *
+ *
+ *
+ * Required. The Distance Measure to use, required.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return The distanceMeasure.
+ */
+ @java.lang.Override
+ public com.google.datastore.v1.FindNearest.DistanceMeasure getDistanceMeasure() {
+ com.google.datastore.v1.FindNearest.DistanceMeasure result =
+ com.google.datastore.v1.FindNearest.DistanceMeasure.forNumber(distanceMeasure_);
+ return result == null
+ ? com.google.datastore.v1.FindNearest.DistanceMeasure.UNRECOGNIZED
+ : result;
+ }
+
+ public static final int LIMIT_FIELD_NUMBER = 4;
+ private com.google.protobuf.Int32Value limit_;
+ /**
+ *
+ *
+ *
+ * Required. The number of nearest neighbors to return. Must be a positive
+ * integer of no more than 100.
+ *
+ *
+ * .google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];
+ *
+ * @return Whether the limit field is set.
+ */
+ @java.lang.Override
+ public boolean hasLimit() {
+ return ((bitField0_ & 0x00000004) != 0);
+ }
+ /**
+ *
+ *
+ *
+ * Required. The number of nearest neighbors to return. Must be a positive
+ * integer of no more than 100.
+ *
+ *
+ * .google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];
+ *
+ * @return The limit.
+ */
+ @java.lang.Override
+ public com.google.protobuf.Int32Value getLimit() {
+ return limit_ == null ? com.google.protobuf.Int32Value.getDefaultInstance() : limit_;
+ }
+ /**
+ *
+ *
+ *
+ * Required. The number of nearest neighbors to return. Must be a positive
+ * integer of no more than 100.
+ *
+ *
+ * .google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];
+ */
+ @java.lang.Override
+ public com.google.protobuf.Int32ValueOrBuilder getLimitOrBuilder() {
+ return limit_ == null ? com.google.protobuf.Int32Value.getDefaultInstance() : limit_;
+ }
+
+ public static final int DISTANCE_RESULT_PROPERTY_FIELD_NUMBER = 5;
+
+ @SuppressWarnings("serial")
+ private volatile java.lang.Object distanceResultProperty_ = "";
+ /**
+ *
+ *
+ *
+ * Optional. Optional name of the field to output the result of the vector
+ * distance calculation. Must conform to [entity
+ * property][google.datastore.v1.Entity.properties] limitations.
+ *
+ *
+ * string distance_result_property = 5 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ * @return The distanceResultProperty.
+ */
+ @java.lang.Override
+ public java.lang.String getDistanceResultProperty() {
+ java.lang.Object ref = distanceResultProperty_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ distanceResultProperty_ = s;
+ return s;
+ }
+ }
+ /**
+ *
+ *
+ *
+ * Optional. Optional name of the field to output the result of the vector
+ * distance calculation. Must conform to [entity
+ * property][google.datastore.v1.Entity.properties] limitations.
+ *
+ *
+ * string distance_result_property = 5 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ * @return The bytes for distanceResultProperty.
+ */
+ @java.lang.Override
+ public com.google.protobuf.ByteString getDistanceResultPropertyBytes() {
+ java.lang.Object ref = distanceResultProperty_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
+ distanceResultProperty_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ public static final int DISTANCE_THRESHOLD_FIELD_NUMBER = 6;
+ private com.google.protobuf.DoubleValue distanceThreshold_;
+ /**
+ *
+ *
+ *
+ * Optional. Option to specify a threshold for which no less similar documents
+ * will be returned. The behavior of the specified `distance_measure` will
+ * affect the meaning of the distance threshold. Since DOT_PRODUCT distances
+ * increase when the vectors are more similar, the comparison is inverted.
+ *
+ * For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold
+ * For DOT_PRODUCT: WHERE distance >= distance_threshold
+ *
+ *
+ *
+ * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ *
+ * @return Whether the distanceThreshold field is set.
+ */
+ @java.lang.Override
+ public boolean hasDistanceThreshold() {
+ return ((bitField0_ & 0x00000008) != 0);
+ }
+ /**
+ *
+ *
+ *
+ * Optional. Option to specify a threshold for which no less similar documents
+ * will be returned. The behavior of the specified `distance_measure` will
+ * affect the meaning of the distance threshold. Since DOT_PRODUCT distances
+ * increase when the vectors are more similar, the comparison is inverted.
+ *
+ * For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold
+ * For DOT_PRODUCT: WHERE distance >= distance_threshold
+ *
+ *
+ *
+ * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ *
+ * @return The distanceThreshold.
+ */
+ @java.lang.Override
+ public com.google.protobuf.DoubleValue getDistanceThreshold() {
+ return distanceThreshold_ == null
+ ? com.google.protobuf.DoubleValue.getDefaultInstance()
+ : distanceThreshold_;
+ }
+ /**
+ *
+ *
+ *
+ * Optional. Option to specify a threshold for which no less similar documents
+ * will be returned. The behavior of the specified `distance_measure` will
+ * affect the meaning of the distance threshold. Since DOT_PRODUCT distances
+ * increase when the vectors are more similar, the comparison is inverted.
+ *
+ * For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold
+ * For DOT_PRODUCT: WHERE distance >= distance_threshold
+ *
+ *
+ *
+ * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ */
+ @java.lang.Override
+ public com.google.protobuf.DoubleValueOrBuilder getDistanceThresholdOrBuilder() {
+ return distanceThreshold_ == null
+ ? com.google.protobuf.DoubleValue.getDefaultInstance()
+ : distanceThreshold_;
+ }
+
+ private byte memoizedIsInitialized = -1;
+
+ @java.lang.Override
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized == 1) return true;
+ if (isInitialized == 0) return false;
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ @java.lang.Override
+ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
+ if (((bitField0_ & 0x00000001) != 0)) {
+ output.writeMessage(1, getVectorProperty());
+ }
+ if (((bitField0_ & 0x00000002) != 0)) {
+ output.writeMessage(2, getQueryVector());
+ }
+ if (distanceMeasure_
+ != com.google.datastore.v1.FindNearest.DistanceMeasure.DISTANCE_MEASURE_UNSPECIFIED
+ .getNumber()) {
+ output.writeEnum(3, distanceMeasure_);
+ }
+ if (((bitField0_ & 0x00000004) != 0)) {
+ output.writeMessage(4, getLimit());
+ }
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(distanceResultProperty_)) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 5, distanceResultProperty_);
+ }
+ if (((bitField0_ & 0x00000008) != 0)) {
+ output.writeMessage(6, getDistanceThreshold());
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ @java.lang.Override
+ public int getSerializedSize() {
+ int size = memoizedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) != 0)) {
+ size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getVectorProperty());
+ }
+ if (((bitField0_ & 0x00000002) != 0)) {
+ size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getQueryVector());
+ }
+ if (distanceMeasure_
+ != com.google.datastore.v1.FindNearest.DistanceMeasure.DISTANCE_MEASURE_UNSPECIFIED
+ .getNumber()) {
+ size += com.google.protobuf.CodedOutputStream.computeEnumSize(3, distanceMeasure_);
+ }
+ if (((bitField0_ & 0x00000004) != 0)) {
+ size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getLimit());
+ }
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(distanceResultProperty_)) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, distanceResultProperty_);
+ }
+ if (((bitField0_ & 0x00000008) != 0)) {
+ size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getDistanceThreshold());
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSize = size;
+ return size;
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof com.google.datastore.v1.FindNearest)) {
+ return super.equals(obj);
+ }
+ com.google.datastore.v1.FindNearest other = (com.google.datastore.v1.FindNearest) obj;
+
+ if (hasVectorProperty() != other.hasVectorProperty()) return false;
+ if (hasVectorProperty()) {
+ if (!getVectorProperty().equals(other.getVectorProperty())) return false;
+ }
+ if (hasQueryVector() != other.hasQueryVector()) return false;
+ if (hasQueryVector()) {
+ if (!getQueryVector().equals(other.getQueryVector())) return false;
+ }
+ if (distanceMeasure_ != other.distanceMeasure_) return false;
+ if (hasLimit() != other.hasLimit()) return false;
+ if (hasLimit()) {
+ if (!getLimit().equals(other.getLimit())) return false;
+ }
+ if (!getDistanceResultProperty().equals(other.getDistanceResultProperty())) return false;
+ if (hasDistanceThreshold() != other.hasDistanceThreshold()) return false;
+ if (hasDistanceThreshold()) {
+ if (!getDistanceThreshold().equals(other.getDistanceThreshold())) return false;
+ }
+ if (!getUnknownFields().equals(other.getUnknownFields())) return false;
+ return true;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ if (hasVectorProperty()) {
+ hash = (37 * hash) + VECTOR_PROPERTY_FIELD_NUMBER;
+ hash = (53 * hash) + getVectorProperty().hashCode();
+ }
+ if (hasQueryVector()) {
+ hash = (37 * hash) + QUERY_VECTOR_FIELD_NUMBER;
+ hash = (53 * hash) + getQueryVector().hashCode();
+ }
+ hash = (37 * hash) + DISTANCE_MEASURE_FIELD_NUMBER;
+ hash = (53 * hash) + distanceMeasure_;
+ if (hasLimit()) {
+ hash = (37 * hash) + LIMIT_FIELD_NUMBER;
+ hash = (53 * hash) + getLimit().hashCode();
+ }
+ hash = (37 * hash) + DISTANCE_RESULT_PROPERTY_FIELD_NUMBER;
+ hash = (53 * hash) + getDistanceResultProperty().hashCode();
+ if (hasDistanceThreshold()) {
+ hash = (37 * hash) + DISTANCE_THRESHOLD_FIELD_NUMBER;
+ hash = (53 * hash) + getDistanceThreshold().hashCode();
+ }
+ hash = (29 * hash) + getUnknownFields().hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static com.google.datastore.v1.FindNearest parseFrom(java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+
+ public static com.google.datastore.v1.FindNearest parseFrom(
+ java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+
+ public static com.google.datastore.v1.FindNearest parseFrom(com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+
+ public static com.google.datastore.v1.FindNearest parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+
+ public static com.google.datastore.v1.FindNearest parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+
+ public static com.google.datastore.v1.FindNearest parseFrom(
+ byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+
+ public static com.google.datastore.v1.FindNearest parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
+ }
+
+ public static com.google.datastore.v1.FindNearest parseFrom(
+ java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
+ PARSER, input, extensionRegistry);
+ }
+
+ public static com.google.datastore.v1.FindNearest parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
+ }
+
+ public static com.google.datastore.v1.FindNearest parseDelimitedFrom(
+ java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
+ PARSER, input, extensionRegistry);
+ }
+
+ public static com.google.datastore.v1.FindNearest parseFrom(
+ com.google.protobuf.CodedInputStream input) throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
+ }
+
+ public static com.google.datastore.v1.FindNearest parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
+ PARSER, input, extensionRegistry);
+ }
+
+ @java.lang.Override
+ public Builder newBuilderForType() {
+ return newBuilder();
+ }
+
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
+
+ public static Builder newBuilder(com.google.datastore.v1.FindNearest prototype) {
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+
+ @java.lang.Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
+ }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ *
+ *
+ *
+ * Nearest Neighbors search config. The ordering provided by FindNearest
+ * supersedes the order_by stage. If multiple documents have the same vector
+ * distance, the returned document order is not guaranteed to be stable between
+ * queries.
+ *
+ *
+ * Protobuf type {@code google.datastore.v1.FindNearest}
+ */
+ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder
+ * Required. An indexed vector property to search upon. Only documents which
+ * contain vectors whose dimensionality match the query_vector can be
+ * returned.
+ *
+ *
+ *
+ * .google.datastore.v1.PropertyReference vector_property = 1 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return Whether the vectorProperty field is set.
+ */
+ public boolean hasVectorProperty() {
+ return ((bitField0_ & 0x00000001) != 0);
+ }
+ /**
+ *
+ *
+ *
+ * Required. An indexed vector property to search upon. Only documents which
+ * contain vectors whose dimensionality match the query_vector can be
+ * returned.
+ *
+ *
+ *
+ * .google.datastore.v1.PropertyReference vector_property = 1 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return The vectorProperty.
+ */
+ public com.google.datastore.v1.PropertyReference getVectorProperty() {
+ if (vectorPropertyBuilder_ == null) {
+ return vectorProperty_ == null
+ ? com.google.datastore.v1.PropertyReference.getDefaultInstance()
+ : vectorProperty_;
+ } else {
+ return vectorPropertyBuilder_.getMessage();
+ }
+ }
+ /**
+ *
+ *
+ *
+ * Required. An indexed vector property to search upon. Only documents which
+ * contain vectors whose dimensionality match the query_vector can be
+ * returned.
+ *
+ *
+ *
+ * .google.datastore.v1.PropertyReference vector_property = 1 [(.google.api.field_behavior) = REQUIRED];
+ *
+ */
+ public Builder setVectorProperty(com.google.datastore.v1.PropertyReference value) {
+ if (vectorPropertyBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ vectorProperty_ = value;
+ } else {
+ vectorPropertyBuilder_.setMessage(value);
+ }
+ bitField0_ |= 0x00000001;
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Required. An indexed vector property to search upon. Only documents which
+ * contain vectors whose dimensionality match the query_vector can be
+ * returned.
+ *
+ *
+ *
+ * .google.datastore.v1.PropertyReference vector_property = 1 [(.google.api.field_behavior) = REQUIRED];
+ *
+ */
+ public Builder setVectorProperty(
+ com.google.datastore.v1.PropertyReference.Builder builderForValue) {
+ if (vectorPropertyBuilder_ == null) {
+ vectorProperty_ = builderForValue.build();
+ } else {
+ vectorPropertyBuilder_.setMessage(builderForValue.build());
+ }
+ bitField0_ |= 0x00000001;
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Required. An indexed vector property to search upon. Only documents which
+ * contain vectors whose dimensionality match the query_vector can be
+ * returned.
+ *
+ *
+ *
+ * .google.datastore.v1.PropertyReference vector_property = 1 [(.google.api.field_behavior) = REQUIRED];
+ *
+ */
+ public Builder mergeVectorProperty(com.google.datastore.v1.PropertyReference value) {
+ if (vectorPropertyBuilder_ == null) {
+ if (((bitField0_ & 0x00000001) != 0)
+ && vectorProperty_ != null
+ && vectorProperty_ != com.google.datastore.v1.PropertyReference.getDefaultInstance()) {
+ getVectorPropertyBuilder().mergeFrom(value);
+ } else {
+ vectorProperty_ = value;
+ }
+ } else {
+ vectorPropertyBuilder_.mergeFrom(value);
+ }
+ if (vectorProperty_ != null) {
+ bitField0_ |= 0x00000001;
+ onChanged();
+ }
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Required. An indexed vector property to search upon. Only documents which
+ * contain vectors whose dimensionality match the query_vector can be
+ * returned.
+ *
+ *
+ *
+ * .google.datastore.v1.PropertyReference vector_property = 1 [(.google.api.field_behavior) = REQUIRED];
+ *
+ */
+ public Builder clearVectorProperty() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ vectorProperty_ = null;
+ if (vectorPropertyBuilder_ != null) {
+ vectorPropertyBuilder_.dispose();
+ vectorPropertyBuilder_ = null;
+ }
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Required. An indexed vector property to search upon. Only documents which
+ * contain vectors whose dimensionality match the query_vector can be
+ * returned.
+ *
+ *
+ *
+ * .google.datastore.v1.PropertyReference vector_property = 1 [(.google.api.field_behavior) = REQUIRED];
+ *
+ */
+ public com.google.datastore.v1.PropertyReference.Builder getVectorPropertyBuilder() {
+ bitField0_ |= 0x00000001;
+ onChanged();
+ return getVectorPropertyFieldBuilder().getBuilder();
+ }
+ /**
+ *
+ *
+ *
+ * Required. An indexed vector property to search upon. Only documents which
+ * contain vectors whose dimensionality match the query_vector can be
+ * returned.
+ *
+ *
+ *
+ * .google.datastore.v1.PropertyReference vector_property = 1 [(.google.api.field_behavior) = REQUIRED];
+ *
+ */
+ public com.google.datastore.v1.PropertyReferenceOrBuilder getVectorPropertyOrBuilder() {
+ if (vectorPropertyBuilder_ != null) {
+ return vectorPropertyBuilder_.getMessageOrBuilder();
+ } else {
+ return vectorProperty_ == null
+ ? com.google.datastore.v1.PropertyReference.getDefaultInstance()
+ : vectorProperty_;
+ }
+ }
+ /**
+ *
+ *
+ *
+ * Required. An indexed vector property to search upon. Only documents which
+ * contain vectors whose dimensionality match the query_vector can be
+ * returned.
+ *
+ *
+ *
+ * .google.datastore.v1.PropertyReference vector_property = 1 [(.google.api.field_behavior) = REQUIRED];
+ *
+ */
+ private com.google.protobuf.SingleFieldBuilderV3<
+ com.google.datastore.v1.PropertyReference,
+ com.google.datastore.v1.PropertyReference.Builder,
+ com.google.datastore.v1.PropertyReferenceOrBuilder>
+ getVectorPropertyFieldBuilder() {
+ if (vectorPropertyBuilder_ == null) {
+ vectorPropertyBuilder_ =
+ new com.google.protobuf.SingleFieldBuilderV3<
+ com.google.datastore.v1.PropertyReference,
+ com.google.datastore.v1.PropertyReference.Builder,
+ com.google.datastore.v1.PropertyReferenceOrBuilder>(
+ getVectorProperty(), getParentForChildren(), isClean());
+ vectorProperty_ = null;
+ }
+ return vectorPropertyBuilder_;
+ }
+
+ private com.google.datastore.v1.Value queryVector_;
+ private com.google.protobuf.SingleFieldBuilderV3<
+ com.google.datastore.v1.Value,
+ com.google.datastore.v1.Value.Builder,
+ com.google.datastore.v1.ValueOrBuilder>
+ queryVectorBuilder_;
+ /**
+ *
+ *
+ *
+ * Required. The query vector that we are searching on. Must be a vector of no
+ * more than 2048 dimensions.
+ *
+ *
+ * .google.datastore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return Whether the queryVector field is set.
+ */
+ public boolean hasQueryVector() {
+ return ((bitField0_ & 0x00000002) != 0);
+ }
+ /**
+ *
+ *
+ *
+ * Required. The query vector that we are searching on. Must be a vector of no
+ * more than 2048 dimensions.
+ *
+ *
+ * .google.datastore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return The queryVector.
+ */
+ public com.google.datastore.v1.Value getQueryVector() {
+ if (queryVectorBuilder_ == null) {
+ return queryVector_ == null
+ ? com.google.datastore.v1.Value.getDefaultInstance()
+ : queryVector_;
+ } else {
+ return queryVectorBuilder_.getMessage();
+ }
+ }
+ /**
+ *
+ *
+ *
+ * Required. The query vector that we are searching on. Must be a vector of no
+ * more than 2048 dimensions.
+ *
+ *
+ * .google.datastore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ */
+ public Builder setQueryVector(com.google.datastore.v1.Value value) {
+ if (queryVectorBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ queryVector_ = value;
+ } else {
+ queryVectorBuilder_.setMessage(value);
+ }
+ bitField0_ |= 0x00000002;
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Required. The query vector that we are searching on. Must be a vector of no
+ * more than 2048 dimensions.
+ *
+ *
+ * .google.datastore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ */
+ public Builder setQueryVector(com.google.datastore.v1.Value.Builder builderForValue) {
+ if (queryVectorBuilder_ == null) {
+ queryVector_ = builderForValue.build();
+ } else {
+ queryVectorBuilder_.setMessage(builderForValue.build());
+ }
+ bitField0_ |= 0x00000002;
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Required. The query vector that we are searching on. Must be a vector of no
+ * more than 2048 dimensions.
+ *
+ *
+ * .google.datastore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ */
+ public Builder mergeQueryVector(com.google.datastore.v1.Value value) {
+ if (queryVectorBuilder_ == null) {
+ if (((bitField0_ & 0x00000002) != 0)
+ && queryVector_ != null
+ && queryVector_ != com.google.datastore.v1.Value.getDefaultInstance()) {
+ getQueryVectorBuilder().mergeFrom(value);
+ } else {
+ queryVector_ = value;
+ }
+ } else {
+ queryVectorBuilder_.mergeFrom(value);
+ }
+ if (queryVector_ != null) {
+ bitField0_ |= 0x00000002;
+ onChanged();
+ }
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Required. The query vector that we are searching on. Must be a vector of no
+ * more than 2048 dimensions.
+ *
+ *
+ * .google.datastore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ */
+ public Builder clearQueryVector() {
+ bitField0_ = (bitField0_ & ~0x00000002);
+ queryVector_ = null;
+ if (queryVectorBuilder_ != null) {
+ queryVectorBuilder_.dispose();
+ queryVectorBuilder_ = null;
+ }
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Required. The query vector that we are searching on. Must be a vector of no
+ * more than 2048 dimensions.
+ *
+ *
+ * .google.datastore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ */
+ public com.google.datastore.v1.Value.Builder getQueryVectorBuilder() {
+ bitField0_ |= 0x00000002;
+ onChanged();
+ return getQueryVectorFieldBuilder().getBuilder();
+ }
+ /**
+ *
+ *
+ *
+ * Required. The query vector that we are searching on. Must be a vector of no
+ * more than 2048 dimensions.
+ *
+ *
+ * .google.datastore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ */
+ public com.google.datastore.v1.ValueOrBuilder getQueryVectorOrBuilder() {
+ if (queryVectorBuilder_ != null) {
+ return queryVectorBuilder_.getMessageOrBuilder();
+ } else {
+ return queryVector_ == null
+ ? com.google.datastore.v1.Value.getDefaultInstance()
+ : queryVector_;
+ }
+ }
+ /**
+ *
+ *
+ *
+ * Required. The query vector that we are searching on. Must be a vector of no
+ * more than 2048 dimensions.
+ *
+ *
+ * .google.datastore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ */
+ private com.google.protobuf.SingleFieldBuilderV3<
+ com.google.datastore.v1.Value,
+ com.google.datastore.v1.Value.Builder,
+ com.google.datastore.v1.ValueOrBuilder>
+ getQueryVectorFieldBuilder() {
+ if (queryVectorBuilder_ == null) {
+ queryVectorBuilder_ =
+ new com.google.protobuf.SingleFieldBuilderV3<
+ com.google.datastore.v1.Value,
+ com.google.datastore.v1.Value.Builder,
+ com.google.datastore.v1.ValueOrBuilder>(
+ getQueryVector(), getParentForChildren(), isClean());
+ queryVector_ = null;
+ }
+ return queryVectorBuilder_;
+ }
+
+ private int distanceMeasure_ = 0;
+ /**
+ *
+ *
+ *
+ * Required. The Distance Measure to use, required.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return The enum numeric value on the wire for distanceMeasure.
+ */
+ @java.lang.Override
+ public int getDistanceMeasureValue() {
+ return distanceMeasure_;
+ }
+ /**
+ *
+ *
+ *
+ * Required. The Distance Measure to use, required.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @param value The enum numeric value on the wire for distanceMeasure to set.
+ * @return This builder for chaining.
+ */
+ public Builder setDistanceMeasureValue(int value) {
+ distanceMeasure_ = value;
+ bitField0_ |= 0x00000004;
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Required. The Distance Measure to use, required.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return The distanceMeasure.
+ */
+ @java.lang.Override
+ public com.google.datastore.v1.FindNearest.DistanceMeasure getDistanceMeasure() {
+ com.google.datastore.v1.FindNearest.DistanceMeasure result =
+ com.google.datastore.v1.FindNearest.DistanceMeasure.forNumber(distanceMeasure_);
+ return result == null
+ ? com.google.datastore.v1.FindNearest.DistanceMeasure.UNRECOGNIZED
+ : result;
+ }
+ /**
+ *
+ *
+ *
+ * Required. The Distance Measure to use, required.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @param value The distanceMeasure to set.
+ * @return This builder for chaining.
+ */
+ public Builder setDistanceMeasure(com.google.datastore.v1.FindNearest.DistanceMeasure value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000004;
+ distanceMeasure_ = value.getNumber();
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Required. The Distance Measure to use, required.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return This builder for chaining.
+ */
+ public Builder clearDistanceMeasure() {
+ bitField0_ = (bitField0_ & ~0x00000004);
+ distanceMeasure_ = 0;
+ onChanged();
+ return this;
+ }
+
+ private com.google.protobuf.Int32Value limit_;
+ private com.google.protobuf.SingleFieldBuilderV3<
+ com.google.protobuf.Int32Value,
+ com.google.protobuf.Int32Value.Builder,
+ com.google.protobuf.Int32ValueOrBuilder>
+ limitBuilder_;
+ /**
+ *
+ *
+ *
+ * Required. The number of nearest neighbors to return. Must be a positive
+ * integer of no more than 100.
+ *
+ *
+ * .google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];
+ *
+ * @return Whether the limit field is set.
+ */
+ public boolean hasLimit() {
+ return ((bitField0_ & 0x00000008) != 0);
+ }
+ /**
+ *
+ *
+ *
+ * Required. The number of nearest neighbors to return. Must be a positive
+ * integer of no more than 100.
+ *
+ *
+ * .google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];
+ *
+ * @return The limit.
+ */
+ public com.google.protobuf.Int32Value getLimit() {
+ if (limitBuilder_ == null) {
+ return limit_ == null ? com.google.protobuf.Int32Value.getDefaultInstance() : limit_;
+ } else {
+ return limitBuilder_.getMessage();
+ }
+ }
+ /**
+ *
+ *
+ *
+ * Required. The number of nearest neighbors to return. Must be a positive
+ * integer of no more than 100.
+ *
+ *
+ * .google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];
+ */
+ public Builder setLimit(com.google.protobuf.Int32Value value) {
+ if (limitBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ limit_ = value;
+ } else {
+ limitBuilder_.setMessage(value);
+ }
+ bitField0_ |= 0x00000008;
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Required. The number of nearest neighbors to return. Must be a positive
+ * integer of no more than 100.
+ *
+ *
+ * .google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];
+ */
+ public Builder setLimit(com.google.protobuf.Int32Value.Builder builderForValue) {
+ if (limitBuilder_ == null) {
+ limit_ = builderForValue.build();
+ } else {
+ limitBuilder_.setMessage(builderForValue.build());
+ }
+ bitField0_ |= 0x00000008;
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Required. The number of nearest neighbors to return. Must be a positive
+ * integer of no more than 100.
+ *
+ *
+ * .google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];
+ */
+ public Builder mergeLimit(com.google.protobuf.Int32Value value) {
+ if (limitBuilder_ == null) {
+ if (((bitField0_ & 0x00000008) != 0)
+ && limit_ != null
+ && limit_ != com.google.protobuf.Int32Value.getDefaultInstance()) {
+ getLimitBuilder().mergeFrom(value);
+ } else {
+ limit_ = value;
+ }
+ } else {
+ limitBuilder_.mergeFrom(value);
+ }
+ if (limit_ != null) {
+ bitField0_ |= 0x00000008;
+ onChanged();
+ }
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Required. The number of nearest neighbors to return. Must be a positive
+ * integer of no more than 100.
+ *
+ *
+ * .google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];
+ */
+ public Builder clearLimit() {
+ bitField0_ = (bitField0_ & ~0x00000008);
+ limit_ = null;
+ if (limitBuilder_ != null) {
+ limitBuilder_.dispose();
+ limitBuilder_ = null;
+ }
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Required. The number of nearest neighbors to return. Must be a positive
+ * integer of no more than 100.
+ *
+ *
+ * .google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];
+ */
+ public com.google.protobuf.Int32Value.Builder getLimitBuilder() {
+ bitField0_ |= 0x00000008;
+ onChanged();
+ return getLimitFieldBuilder().getBuilder();
+ }
+ /**
+ *
+ *
+ *
+ * Required. The number of nearest neighbors to return. Must be a positive
+ * integer of no more than 100.
+ *
+ *
+ * .google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];
+ */
+ public com.google.protobuf.Int32ValueOrBuilder getLimitOrBuilder() {
+ if (limitBuilder_ != null) {
+ return limitBuilder_.getMessageOrBuilder();
+ } else {
+ return limit_ == null ? com.google.protobuf.Int32Value.getDefaultInstance() : limit_;
+ }
+ }
+ /**
+ *
+ *
+ *
+ * Required. The number of nearest neighbors to return. Must be a positive
+ * integer of no more than 100.
+ *
+ *
+ * .google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];
+ */
+ private com.google.protobuf.SingleFieldBuilderV3<
+ com.google.protobuf.Int32Value,
+ com.google.protobuf.Int32Value.Builder,
+ com.google.protobuf.Int32ValueOrBuilder>
+ getLimitFieldBuilder() {
+ if (limitBuilder_ == null) {
+ limitBuilder_ =
+ new com.google.protobuf.SingleFieldBuilderV3<
+ com.google.protobuf.Int32Value,
+ com.google.protobuf.Int32Value.Builder,
+ com.google.protobuf.Int32ValueOrBuilder>(
+ getLimit(), getParentForChildren(), isClean());
+ limit_ = null;
+ }
+ return limitBuilder_;
+ }
+
+ private java.lang.Object distanceResultProperty_ = "";
+ /**
+ *
+ *
+ *
+ * Optional. Optional name of the field to output the result of the vector
+ * distance calculation. Must conform to [entity
+ * property][google.datastore.v1.Entity.properties] limitations.
+ *
+ *
+ * string distance_result_property = 5 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ * @return The distanceResultProperty.
+ */
+ public java.lang.String getDistanceResultProperty() {
+ java.lang.Object ref = distanceResultProperty_;
+ if (!(ref instanceof java.lang.String)) {
+ com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ distanceResultProperty_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ *
+ *
+ *
+ * Optional. Optional name of the field to output the result of the vector
+ * distance calculation. Must conform to [entity
+ * property][google.datastore.v1.Entity.properties] limitations.
+ *
+ *
+ * string distance_result_property = 5 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ * @return The bytes for distanceResultProperty.
+ */
+ public com.google.protobuf.ByteString getDistanceResultPropertyBytes() {
+ java.lang.Object ref = distanceResultProperty_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
+ distanceResultProperty_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ *
+ *
+ *
+ * Optional. Optional name of the field to output the result of the vector
+ * distance calculation. Must conform to [entity
+ * property][google.datastore.v1.Entity.properties] limitations.
+ *
+ *
+ * string distance_result_property = 5 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ * @param value The distanceResultProperty to set.
+ * @return This builder for chaining.
+ */
+ public Builder setDistanceResultProperty(java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ distanceResultProperty_ = value;
+ bitField0_ |= 0x00000010;
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Optional. Optional name of the field to output the result of the vector
+ * distance calculation. Must conform to [entity
+ * property][google.datastore.v1.Entity.properties] limitations.
+ *
+ *
+ * string distance_result_property = 5 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ * @return This builder for chaining.
+ */
+ public Builder clearDistanceResultProperty() {
+ distanceResultProperty_ = getDefaultInstance().getDistanceResultProperty();
+ bitField0_ = (bitField0_ & ~0x00000010);
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Optional. Optional name of the field to output the result of the vector
+ * distance calculation. Must conform to [entity
+ * property][google.datastore.v1.Entity.properties] limitations.
+ *
+ *
+ * string distance_result_property = 5 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ * @param value The bytes for distanceResultProperty to set.
+ * @return This builder for chaining.
+ */
+ public Builder setDistanceResultPropertyBytes(com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+ distanceResultProperty_ = value;
+ bitField0_ |= 0x00000010;
+ onChanged();
+ return this;
+ }
+
+ private com.google.protobuf.DoubleValue distanceThreshold_;
+ private com.google.protobuf.SingleFieldBuilderV3<
+ com.google.protobuf.DoubleValue,
+ com.google.protobuf.DoubleValue.Builder,
+ com.google.protobuf.DoubleValueOrBuilder>
+ distanceThresholdBuilder_;
+ /**
+ *
+ *
+ *
+ * Optional. Option to specify a threshold for which no less similar documents
+ * will be returned. The behavior of the specified `distance_measure` will
+ * affect the meaning of the distance threshold. Since DOT_PRODUCT distances
+ * increase when the vectors are more similar, the comparison is inverted.
+ *
+ * For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold
+ * For DOT_PRODUCT: WHERE distance >= distance_threshold
+ *
+ *
+ *
+ * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ *
+ * @return Whether the distanceThreshold field is set.
+ */
+ public boolean hasDistanceThreshold() {
+ return ((bitField0_ & 0x00000020) != 0);
+ }
+ /**
+ *
+ *
+ *
+ * Optional. Option to specify a threshold for which no less similar documents
+ * will be returned. The behavior of the specified `distance_measure` will
+ * affect the meaning of the distance threshold. Since DOT_PRODUCT distances
+ * increase when the vectors are more similar, the comparison is inverted.
+ *
+ * For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold
+ * For DOT_PRODUCT: WHERE distance >= distance_threshold
+ *
+ *
+ *
+ * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ *
+ * @return The distanceThreshold.
+ */
+ public com.google.protobuf.DoubleValue getDistanceThreshold() {
+ if (distanceThresholdBuilder_ == null) {
+ return distanceThreshold_ == null
+ ? com.google.protobuf.DoubleValue.getDefaultInstance()
+ : distanceThreshold_;
+ } else {
+ return distanceThresholdBuilder_.getMessage();
+ }
+ }
+ /**
+ *
+ *
+ *
+ * Optional. Option to specify a threshold for which no less similar documents
+ * will be returned. The behavior of the specified `distance_measure` will
+ * affect the meaning of the distance threshold. Since DOT_PRODUCT distances
+ * increase when the vectors are more similar, the comparison is inverted.
+ *
+ * For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold
+ * For DOT_PRODUCT: WHERE distance >= distance_threshold
+ *
+ *
+ *
+ * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ */
+ public Builder setDistanceThreshold(com.google.protobuf.DoubleValue value) {
+ if (distanceThresholdBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ distanceThreshold_ = value;
+ } else {
+ distanceThresholdBuilder_.setMessage(value);
+ }
+ bitField0_ |= 0x00000020;
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Optional. Option to specify a threshold for which no less similar documents
+ * will be returned. The behavior of the specified `distance_measure` will
+ * affect the meaning of the distance threshold. Since DOT_PRODUCT distances
+ * increase when the vectors are more similar, the comparison is inverted.
+ *
+ * For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold
+ * For DOT_PRODUCT: WHERE distance >= distance_threshold
+ *
+ *
+ *
+ * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ */
+ public Builder setDistanceThreshold(com.google.protobuf.DoubleValue.Builder builderForValue) {
+ if (distanceThresholdBuilder_ == null) {
+ distanceThreshold_ = builderForValue.build();
+ } else {
+ distanceThresholdBuilder_.setMessage(builderForValue.build());
+ }
+ bitField0_ |= 0x00000020;
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Optional. Option to specify a threshold for which no less similar documents
+ * will be returned. The behavior of the specified `distance_measure` will
+ * affect the meaning of the distance threshold. Since DOT_PRODUCT distances
+ * increase when the vectors are more similar, the comparison is inverted.
+ *
+ * For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold
+ * For DOT_PRODUCT: WHERE distance >= distance_threshold
+ *
+ *
+ *
+ * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ */
+ public Builder mergeDistanceThreshold(com.google.protobuf.DoubleValue value) {
+ if (distanceThresholdBuilder_ == null) {
+ if (((bitField0_ & 0x00000020) != 0)
+ && distanceThreshold_ != null
+ && distanceThreshold_ != com.google.protobuf.DoubleValue.getDefaultInstance()) {
+ getDistanceThresholdBuilder().mergeFrom(value);
+ } else {
+ distanceThreshold_ = value;
+ }
+ } else {
+ distanceThresholdBuilder_.mergeFrom(value);
+ }
+ if (distanceThreshold_ != null) {
+ bitField0_ |= 0x00000020;
+ onChanged();
+ }
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Optional. Option to specify a threshold for which no less similar documents
+ * will be returned. The behavior of the specified `distance_measure` will
+ * affect the meaning of the distance threshold. Since DOT_PRODUCT distances
+ * increase when the vectors are more similar, the comparison is inverted.
+ *
+ * For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold
+ * For DOT_PRODUCT: WHERE distance >= distance_threshold
+ *
+ *
+ *
+ * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ */
+ public Builder clearDistanceThreshold() {
+ bitField0_ = (bitField0_ & ~0x00000020);
+ distanceThreshold_ = null;
+ if (distanceThresholdBuilder_ != null) {
+ distanceThresholdBuilder_.dispose();
+ distanceThresholdBuilder_ = null;
+ }
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Optional. Option to specify a threshold for which no less similar documents
+ * will be returned. The behavior of the specified `distance_measure` will
+ * affect the meaning of the distance threshold. Since DOT_PRODUCT distances
+ * increase when the vectors are more similar, the comparison is inverted.
+ *
+ * For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold
+ * For DOT_PRODUCT: WHERE distance >= distance_threshold
+ *
+ *
+ *
+ * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ */
+ public com.google.protobuf.DoubleValue.Builder getDistanceThresholdBuilder() {
+ bitField0_ |= 0x00000020;
+ onChanged();
+ return getDistanceThresholdFieldBuilder().getBuilder();
+ }
+ /**
+ *
+ *
+ *
+ * Optional. Option to specify a threshold for which no less similar documents
+ * will be returned. The behavior of the specified `distance_measure` will
+ * affect the meaning of the distance threshold. Since DOT_PRODUCT distances
+ * increase when the vectors are more similar, the comparison is inverted.
+ *
+ * For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold
+ * For DOT_PRODUCT: WHERE distance >= distance_threshold
+ *
+ *
+ *
+ * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ */
+ public com.google.protobuf.DoubleValueOrBuilder getDistanceThresholdOrBuilder() {
+ if (distanceThresholdBuilder_ != null) {
+ return distanceThresholdBuilder_.getMessageOrBuilder();
+ } else {
+ return distanceThreshold_ == null
+ ? com.google.protobuf.DoubleValue.getDefaultInstance()
+ : distanceThreshold_;
+ }
+ }
+ /**
+ *
+ *
+ *
+ * Optional. Option to specify a threshold for which no less similar documents
+ * will be returned. The behavior of the specified `distance_measure` will
+ * affect the meaning of the distance threshold. Since DOT_PRODUCT distances
+ * increase when the vectors are more similar, the comparison is inverted.
+ *
+ * For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold
+ * For DOT_PRODUCT: WHERE distance >= distance_threshold
+ *
+ *
+ *
+ * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ */
+ private com.google.protobuf.SingleFieldBuilderV3<
+ com.google.protobuf.DoubleValue,
+ com.google.protobuf.DoubleValue.Builder,
+ com.google.protobuf.DoubleValueOrBuilder>
+ getDistanceThresholdFieldBuilder() {
+ if (distanceThresholdBuilder_ == null) {
+ distanceThresholdBuilder_ =
+ new com.google.protobuf.SingleFieldBuilderV3<
+ com.google.protobuf.DoubleValue,
+ com.google.protobuf.DoubleValue.Builder,
+ com.google.protobuf.DoubleValueOrBuilder>(
+ getDistanceThreshold(), getParentForChildren(), isClean());
+ distanceThreshold_ = null;
+ }
+ return distanceThresholdBuilder_;
+ }
+
+ @java.lang.Override
+ public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @java.lang.Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
+ // @@protoc_insertion_point(builder_scope:google.datastore.v1.FindNearest)
+ }
+
+ // @@protoc_insertion_point(class_scope:google.datastore.v1.FindNearest)
+ private static final com.google.datastore.v1.FindNearest DEFAULT_INSTANCE;
+
+ static {
+ DEFAULT_INSTANCE = new com.google.datastore.v1.FindNearest();
+ }
+
+ public static com.google.datastore.v1.FindNearest getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ private static final com.google.protobuf.Parser
+ * Required. An indexed vector property to search upon. Only documents which
+ * contain vectors whose dimensionality match the query_vector can be
+ * returned.
+ *
+ *
+ *
+ * .google.datastore.v1.PropertyReference vector_property = 1 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return Whether the vectorProperty field is set.
+ */
+ boolean hasVectorProperty();
+ /**
+ *
+ *
+ *
+ * Required. An indexed vector property to search upon. Only documents which
+ * contain vectors whose dimensionality match the query_vector can be
+ * returned.
+ *
+ *
+ *
+ * .google.datastore.v1.PropertyReference vector_property = 1 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return The vectorProperty.
+ */
+ com.google.datastore.v1.PropertyReference getVectorProperty();
+ /**
+ *
+ *
+ *
+ * Required. An indexed vector property to search upon. Only documents which
+ * contain vectors whose dimensionality match the query_vector can be
+ * returned.
+ *
+ *
+ *
+ * .google.datastore.v1.PropertyReference vector_property = 1 [(.google.api.field_behavior) = REQUIRED];
+ *
+ */
+ com.google.datastore.v1.PropertyReferenceOrBuilder getVectorPropertyOrBuilder();
+
+ /**
+ *
+ *
+ *
+ * Required. The query vector that we are searching on. Must be a vector of no
+ * more than 2048 dimensions.
+ *
+ *
+ * .google.datastore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return Whether the queryVector field is set.
+ */
+ boolean hasQueryVector();
+ /**
+ *
+ *
+ *
+ * Required. The query vector that we are searching on. Must be a vector of no
+ * more than 2048 dimensions.
+ *
+ *
+ * .google.datastore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return The queryVector.
+ */
+ com.google.datastore.v1.Value getQueryVector();
+ /**
+ *
+ *
+ *
+ * Required. The query vector that we are searching on. Must be a vector of no
+ * more than 2048 dimensions.
+ *
+ *
+ * .google.datastore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ */
+ com.google.datastore.v1.ValueOrBuilder getQueryVectorOrBuilder();
+
+ /**
+ *
+ *
+ *
+ * Required. The Distance Measure to use, required.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return The enum numeric value on the wire for distanceMeasure.
+ */
+ int getDistanceMeasureValue();
+ /**
+ *
+ *
+ *
+ * Required. The Distance Measure to use, required.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return The distanceMeasure.
+ */
+ com.google.datastore.v1.FindNearest.DistanceMeasure getDistanceMeasure();
+
+ /**
+ *
+ *
+ *
+ * Required. The number of nearest neighbors to return. Must be a positive
+ * integer of no more than 100.
+ *
+ *
+ * .google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];
+ *
+ * @return Whether the limit field is set.
+ */
+ boolean hasLimit();
+ /**
+ *
+ *
+ *
+ * Required. The number of nearest neighbors to return. Must be a positive
+ * integer of no more than 100.
+ *
+ *
+ * .google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];
+ *
+ * @return The limit.
+ */
+ com.google.protobuf.Int32Value getLimit();
+ /**
+ *
+ *
+ *
+ * Required. The number of nearest neighbors to return. Must be a positive
+ * integer of no more than 100.
+ *
+ *
+ * .google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];
+ */
+ com.google.protobuf.Int32ValueOrBuilder getLimitOrBuilder();
+
+ /**
+ *
+ *
+ *
+ * Optional. Optional name of the field to output the result of the vector
+ * distance calculation. Must conform to [entity
+ * property][google.datastore.v1.Entity.properties] limitations.
+ *
+ *
+ * string distance_result_property = 5 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ * @return The distanceResultProperty.
+ */
+ java.lang.String getDistanceResultProperty();
+ /**
+ *
+ *
+ *
+ * Optional. Optional name of the field to output the result of the vector
+ * distance calculation. Must conform to [entity
+ * property][google.datastore.v1.Entity.properties] limitations.
+ *
+ *
+ * string distance_result_property = 5 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ * @return The bytes for distanceResultProperty.
+ */
+ com.google.protobuf.ByteString getDistanceResultPropertyBytes();
+
+ /**
+ *
+ *
+ *
+ * Optional. Option to specify a threshold for which no less similar documents
+ * will be returned. The behavior of the specified `distance_measure` will
+ * affect the meaning of the distance threshold. Since DOT_PRODUCT distances
+ * increase when the vectors are more similar, the comparison is inverted.
+ *
+ * For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold
+ * For DOT_PRODUCT: WHERE distance >= distance_threshold
+ *
+ *
+ *
+ * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ *
+ * @return Whether the distanceThreshold field is set.
+ */
+ boolean hasDistanceThreshold();
+ /**
+ *
+ *
+ *
+ * Optional. Option to specify a threshold for which no less similar documents
+ * will be returned. The behavior of the specified `distance_measure` will
+ * affect the meaning of the distance threshold. Since DOT_PRODUCT distances
+ * increase when the vectors are more similar, the comparison is inverted.
+ *
+ * For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold
+ * For DOT_PRODUCT: WHERE distance >= distance_threshold
+ *
+ *
+ *
+ * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ *
+ * @return The distanceThreshold.
+ */
+ com.google.protobuf.DoubleValue getDistanceThreshold();
+ /**
+ *
+ *
+ *
+ * Optional. Option to specify a threshold for which no less similar documents
+ * will be returned. The behavior of the specified `distance_measure` will
+ * affect the meaning of the distance threshold. Since DOT_PRODUCT distances
+ * increase when the vectors are more similar, the comparison is inverted.
+ *
+ * For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold
+ * For DOT_PRODUCT: WHERE distance >= distance_threshold
+ *
+ *
+ *
+ * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ */
+ com.google.protobuf.DoubleValueOrBuilder getDistanceThresholdOrBuilder();
+}
diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Query.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Query.java
index 2c0c40f79..25fba4c89 100644
--- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Query.java
+++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Query.java
@@ -24,6 +24,15 @@
*
*
* A query for entities.
+ *
+ * The query stages are executed in the following order:
+ * 1. kind
+ * 2. filter
+ * 3. projection
+ * 4. order + start_cursor + end_cursor
+ * 5. offset
+ * 6. limit
+ * 7. find_nearest
*
*
* Protobuf type {@code google.datastore.v1.Query}
@@ -553,6 +562,74 @@ public com.google.protobuf.Int32ValueOrBuilder getLimitOrBuilder() {
return limit_ == null ? com.google.protobuf.Int32Value.getDefaultInstance() : limit_;
}
+ public static final int FIND_NEAREST_FIELD_NUMBER = 13;
+ private com.google.datastore.v1.FindNearest findNearest_;
+ /**
+ *
+ *
+ *
+ * Optional. A potential Nearest Neighbors Search.
+ *
+ * Applies after all other filters and ordering.
+ *
+ * Finds the closest vector embeddings to the given query vector.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ *
+ * @return Whether the findNearest field is set.
+ */
+ @java.lang.Override
+ public boolean hasFindNearest() {
+ return ((bitField0_ & 0x00000004) != 0);
+ }
+ /**
+ *
+ *
+ *
+ * Optional. A potential Nearest Neighbors Search.
+ *
+ * Applies after all other filters and ordering.
+ *
+ * Finds the closest vector embeddings to the given query vector.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ *
+ * @return The findNearest.
+ */
+ @java.lang.Override
+ public com.google.datastore.v1.FindNearest getFindNearest() {
+ return findNearest_ == null
+ ? com.google.datastore.v1.FindNearest.getDefaultInstance()
+ : findNearest_;
+ }
+ /**
+ *
+ *
+ *
+ * Optional. A potential Nearest Neighbors Search.
+ *
+ * Applies after all other filters and ordering.
+ *
+ * Finds the closest vector embeddings to the given query vector.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ */
+ @java.lang.Override
+ public com.google.datastore.v1.FindNearestOrBuilder getFindNearestOrBuilder() {
+ return findNearest_ == null
+ ? com.google.datastore.v1.FindNearest.getDefaultInstance()
+ : findNearest_;
+ }
+
private byte memoizedIsInitialized = -1;
@java.lang.Override
@@ -594,6 +671,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io
if (((bitField0_ & 0x00000002) != 0)) {
output.writeMessage(12, getLimit());
}
+ if (((bitField0_ & 0x00000004) != 0)) {
+ output.writeMessage(13, getFindNearest());
+ }
getUnknownFields().writeTo(output);
}
@@ -630,6 +710,9 @@ public int getSerializedSize() {
if (((bitField0_ & 0x00000002) != 0)) {
size += com.google.protobuf.CodedOutputStream.computeMessageSize(12, getLimit());
}
+ if (((bitField0_ & 0x00000004) != 0)) {
+ size += com.google.protobuf.CodedOutputStream.computeMessageSize(13, getFindNearest());
+ }
size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
@@ -660,6 +743,10 @@ public boolean equals(final java.lang.Object obj) {
if (hasLimit()) {
if (!getLimit().equals(other.getLimit())) return false;
}
+ if (hasFindNearest() != other.hasFindNearest()) return false;
+ if (hasFindNearest()) {
+ if (!getFindNearest().equals(other.getFindNearest())) return false;
+ }
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
@@ -701,6 +788,10 @@ public int hashCode() {
hash = (37 * hash) + LIMIT_FIELD_NUMBER;
hash = (53 * hash) + getLimit().hashCode();
}
+ if (hasFindNearest()) {
+ hash = (37 * hash) + FIND_NEAREST_FIELD_NUMBER;
+ hash = (53 * hash) + getFindNearest().hashCode();
+ }
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
@@ -805,6 +896,15 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build
*
*
* A query for entities.
+ *
+ * The query stages are executed in the following order:
+ * 1. kind
+ * 2. filter
+ * 3. projection
+ * 4. order + start_cursor + end_cursor
+ * 5. offset
+ * 6. limit
+ * 7. find_nearest
*
*
* Protobuf type {@code google.datastore.v1.Query}
@@ -845,6 +945,7 @@ private void maybeForceBuilderInitialization() {
getOrderFieldBuilder();
getDistinctOnFieldBuilder();
getLimitFieldBuilder();
+ getFindNearestFieldBuilder();
}
}
@@ -893,6 +994,11 @@ public Builder clear() {
limitBuilder_.dispose();
limitBuilder_ = null;
}
+ findNearest_ = null;
+ if (findNearestBuilder_ != null) {
+ findNearestBuilder_.dispose();
+ findNearestBuilder_ = null;
+ }
return this;
}
@@ -986,6 +1092,11 @@ private void buildPartial0(com.google.datastore.v1.Query result) {
result.limit_ = limitBuilder_ == null ? limit_ : limitBuilder_.build();
to_bitField0_ |= 0x00000002;
}
+ if (((from_bitField0_ & 0x00000200) != 0)) {
+ result.findNearest_ =
+ findNearestBuilder_ == null ? findNearest_ : findNearestBuilder_.build();
+ to_bitField0_ |= 0x00000004;
+ }
result.bitField0_ |= to_bitField0_;
}
@@ -1157,6 +1268,9 @@ public Builder mergeFrom(com.google.datastore.v1.Query other) {
if (other.hasLimit()) {
mergeLimit(other.getLimit());
}
+ if (other.hasFindNearest()) {
+ mergeFindNearest(other.getFindNearest());
+ }
this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
@@ -1265,6 +1379,12 @@ public Builder mergeFrom(
bitField0_ |= 0x00000100;
break;
} // case 98
+ case 106:
+ {
+ input.readMessage(getFindNearestFieldBuilder().getBuilder(), extensionRegistry);
+ bitField0_ |= 0x00000200;
+ break;
+ } // case 106
default:
{
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
@@ -3396,6 +3516,245 @@ public com.google.protobuf.Int32ValueOrBuilder getLimitOrBuilder() {
return limitBuilder_;
}
+ private com.google.datastore.v1.FindNearest findNearest_;
+ private com.google.protobuf.SingleFieldBuilderV3<
+ com.google.datastore.v1.FindNearest,
+ com.google.datastore.v1.FindNearest.Builder,
+ com.google.datastore.v1.FindNearestOrBuilder>
+ findNearestBuilder_;
+ /**
+ *
+ *
+ *
+ * Optional. A potential Nearest Neighbors Search.
+ *
+ * Applies after all other filters and ordering.
+ *
+ * Finds the closest vector embeddings to the given query vector.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ *
+ * @return Whether the findNearest field is set.
+ */
+ public boolean hasFindNearest() {
+ return ((bitField0_ & 0x00000200) != 0);
+ }
+ /**
+ *
+ *
+ *
+ * Optional. A potential Nearest Neighbors Search.
+ *
+ * Applies after all other filters and ordering.
+ *
+ * Finds the closest vector embeddings to the given query vector.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ *
+ * @return The findNearest.
+ */
+ public com.google.datastore.v1.FindNearest getFindNearest() {
+ if (findNearestBuilder_ == null) {
+ return findNearest_ == null
+ ? com.google.datastore.v1.FindNearest.getDefaultInstance()
+ : findNearest_;
+ } else {
+ return findNearestBuilder_.getMessage();
+ }
+ }
+ /**
+ *
+ *
+ *
+ * Optional. A potential Nearest Neighbors Search.
+ *
+ * Applies after all other filters and ordering.
+ *
+ * Finds the closest vector embeddings to the given query vector.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ */
+ public Builder setFindNearest(com.google.datastore.v1.FindNearest value) {
+ if (findNearestBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ findNearest_ = value;
+ } else {
+ findNearestBuilder_.setMessage(value);
+ }
+ bitField0_ |= 0x00000200;
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Optional. A potential Nearest Neighbors Search.
+ *
+ * Applies after all other filters and ordering.
+ *
+ * Finds the closest vector embeddings to the given query vector.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ */
+ public Builder setFindNearest(com.google.datastore.v1.FindNearest.Builder builderForValue) {
+ if (findNearestBuilder_ == null) {
+ findNearest_ = builderForValue.build();
+ } else {
+ findNearestBuilder_.setMessage(builderForValue.build());
+ }
+ bitField0_ |= 0x00000200;
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Optional. A potential Nearest Neighbors Search.
+ *
+ * Applies after all other filters and ordering.
+ *
+ * Finds the closest vector embeddings to the given query vector.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ */
+ public Builder mergeFindNearest(com.google.datastore.v1.FindNearest value) {
+ if (findNearestBuilder_ == null) {
+ if (((bitField0_ & 0x00000200) != 0)
+ && findNearest_ != null
+ && findNearest_ != com.google.datastore.v1.FindNearest.getDefaultInstance()) {
+ getFindNearestBuilder().mergeFrom(value);
+ } else {
+ findNearest_ = value;
+ }
+ } else {
+ findNearestBuilder_.mergeFrom(value);
+ }
+ if (findNearest_ != null) {
+ bitField0_ |= 0x00000200;
+ onChanged();
+ }
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Optional. A potential Nearest Neighbors Search.
+ *
+ * Applies after all other filters and ordering.
+ *
+ * Finds the closest vector embeddings to the given query vector.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ */
+ public Builder clearFindNearest() {
+ bitField0_ = (bitField0_ & ~0x00000200);
+ findNearest_ = null;
+ if (findNearestBuilder_ != null) {
+ findNearestBuilder_.dispose();
+ findNearestBuilder_ = null;
+ }
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Optional. A potential Nearest Neighbors Search.
+ *
+ * Applies after all other filters and ordering.
+ *
+ * Finds the closest vector embeddings to the given query vector.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ */
+ public com.google.datastore.v1.FindNearest.Builder getFindNearestBuilder() {
+ bitField0_ |= 0x00000200;
+ onChanged();
+ return getFindNearestFieldBuilder().getBuilder();
+ }
+ /**
+ *
+ *
+ *
+ * Optional. A potential Nearest Neighbors Search.
+ *
+ * Applies after all other filters and ordering.
+ *
+ * Finds the closest vector embeddings to the given query vector.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ */
+ public com.google.datastore.v1.FindNearestOrBuilder getFindNearestOrBuilder() {
+ if (findNearestBuilder_ != null) {
+ return findNearestBuilder_.getMessageOrBuilder();
+ } else {
+ return findNearest_ == null
+ ? com.google.datastore.v1.FindNearest.getDefaultInstance()
+ : findNearest_;
+ }
+ }
+ /**
+ *
+ *
+ *
+ * Optional. A potential Nearest Neighbors Search.
+ *
+ * Applies after all other filters and ordering.
+ *
+ * Finds the closest vector embeddings to the given query vector.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ */
+ private com.google.protobuf.SingleFieldBuilderV3<
+ com.google.datastore.v1.FindNearest,
+ com.google.datastore.v1.FindNearest.Builder,
+ com.google.datastore.v1.FindNearestOrBuilder>
+ getFindNearestFieldBuilder() {
+ if (findNearestBuilder_ == null) {
+ findNearestBuilder_ =
+ new com.google.protobuf.SingleFieldBuilderV3<
+ com.google.datastore.v1.FindNearest,
+ com.google.datastore.v1.FindNearest.Builder,
+ com.google.datastore.v1.FindNearestOrBuilder>(
+ getFindNearest(), getParentForChildren(), isClean());
+ findNearest_ = null;
+ }
+ return findNearestBuilder_;
+ }
+
@java.lang.Override
public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryOrBuilder.java
index 70533577f..86e6d218f 100644
--- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryOrBuilder.java
+++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryOrBuilder.java
@@ -394,4 +394,57 @@ public interface QueryOrBuilder
* .google.protobuf.Int32Value limit = 12;
*/
com.google.protobuf.Int32ValueOrBuilder getLimitOrBuilder();
+
+ /**
+ *
+ *
+ *
+ * Optional. A potential Nearest Neighbors Search.
+ *
+ * Applies after all other filters and ordering.
+ *
+ * Finds the closest vector embeddings to the given query vector.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ *
+ * @return Whether the findNearest field is set.
+ */
+ boolean hasFindNearest();
+ /**
+ *
+ *
+ *
+ * Optional. A potential Nearest Neighbors Search.
+ *
+ * Applies after all other filters and ordering.
+ *
+ * Finds the closest vector embeddings to the given query vector.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ *
+ * @return The findNearest.
+ */
+ com.google.datastore.v1.FindNearest getFindNearest();
+ /**
+ *
+ *
+ *
+ * Optional. A potential Nearest Neighbors Search.
+ *
+ * Applies after all other filters and ordering.
+ *
+ * Finds the closest vector embeddings to the given query vector.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ */
+ com.google.datastore.v1.FindNearestOrBuilder getFindNearestOrBuilder();
}
diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryProto.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryProto.java
index 60c35e2e1..489e035ab 100644
--- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryProto.java
+++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryProto.java
@@ -84,6 +84,10 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r
internal_static_google_datastore_v1_PropertyFilter_descriptor;
static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_google_datastore_v1_PropertyFilter_fieldAccessorTable;
+ static final com.google.protobuf.Descriptors.Descriptor
+ internal_static_google_datastore_v1_FindNearest_descriptor;
+ static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internal_static_google_datastore_v1_FindNearest_fieldAccessorTable;
static final com.google.protobuf.Descriptors.Descriptor
internal_static_google_datastore_v1_GqlQuery_descriptor;
static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
@@ -120,7 +124,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
+ "date_time\030\005 \001(\0132\032.google.protobuf.Timest"
+ "amp\022\016\n\006cursor\030\003 \001(\014\"Q\n\nResultType\022\033\n\027RES"
+ "ULT_TYPE_UNSPECIFIED\020\000\022\010\n\004FULL\020\001\022\016\n\nPROJ"
- + "ECTION\020\002\022\014\n\010KEY_ONLY\020\003\"\362\002\n\005Query\0223\n\nproj"
+ + "ECTION\020\002\022\014\n\010KEY_ONLY\020\003\"\257\003\n\005Query\0223\n\nproj"
+ "ection\030\002 \003(\0132\037.google.datastore.v1.Proje"
+ "ction\0221\n\004kind\030\003 \003(\0132#.google.datastore.v"
+ "1.KindExpression\022+\n\006filter\030\004 \001(\0132\033.googl"
@@ -129,77 +133,90 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
+ "inct_on\030\006 \003(\0132&.google.datastore.v1.Prop"
+ "ertyReference\022\024\n\014start_cursor\030\007 \001(\014\022\022\n\ne"
+ "nd_cursor\030\010 \001(\014\022\016\n\006offset\030\n \001(\005\022*\n\005limit"
- + "\030\014 \001(\0132\033.google.protobuf.Int32Value\"\344\004\n\020"
- + "AggregationQuery\0222\n\014nested_query\030\001 \001(\0132\032"
- + ".google.datastore.v1.QueryH\000\022L\n\014aggregat"
- + "ions\030\003 \003(\01321.google.datastore.v1.Aggrega"
- + "tionQuery.AggregationB\003\340A\001\032\277\003\n\013Aggregati"
- + "on\022H\n\005count\030\001 \001(\01327.google.datastore.v1."
- + "AggregationQuery.Aggregation.CountH\000\022D\n\003"
- + "sum\030\002 \001(\01325.google.datastore.v1.Aggregat"
- + "ionQuery.Aggregation.SumH\000\022D\n\003avg\030\003 \001(\0132"
- + "5.google.datastore.v1.AggregationQuery.A"
- + "ggregation.AvgH\000\022\022\n\005alias\030\007 \001(\tB\003\340A\001\0328\n\005"
- + "Count\022/\n\005up_to\030\001 \001(\0132\033.google.protobuf.I"
- + "nt64ValueB\003\340A\001\032?\n\003Sum\0228\n\010property\030\001 \001(\0132"
- + "&.google.datastore.v1.PropertyReference\032"
- + "?\n\003Avg\0228\n\010property\030\001 \001(\0132&.google.datast"
- + "ore.v1.PropertyReferenceB\n\n\010operatorB\014\n\n"
- + "query_type\"\036\n\016KindExpression\022\014\n\004name\030\001 \001"
- + "(\t\"!\n\021PropertyReference\022\014\n\004name\030\002 \001(\t\"F\n"
- + "\nProjection\0228\n\010property\030\001 \001(\0132&.google.d"
- + "atastore.v1.PropertyReference\"\321\001\n\rProper"
- + "tyOrder\0228\n\010property\030\001 \001(\0132&.google.datas"
- + "tore.v1.PropertyReference\022?\n\tdirection\030\002"
- + " \001(\0162,.google.datastore.v1.PropertyOrder"
- + ".Direction\"E\n\tDirection\022\031\n\025DIRECTION_UNS"
- + "PECIFIED\020\000\022\r\n\tASCENDING\020\001\022\016\n\nDESCENDING\020"
- + "\002\"\231\001\n\006Filter\022@\n\020composite_filter\030\001 \001(\0132$"
- + ".google.datastore.v1.CompositeFilterH\000\022>"
- + "\n\017property_filter\030\002 \001(\0132#.google.datasto"
- + "re.v1.PropertyFilterH\000B\r\n\013filter_type\"\261\001"
- + "\n\017CompositeFilter\0229\n\002op\030\001 \001(\0162-.google.d"
- + "atastore.v1.CompositeFilter.Operator\022,\n\007"
- + "filters\030\002 \003(\0132\033.google.datastore.v1.Filt"
- + "er\"5\n\010Operator\022\030\n\024OPERATOR_UNSPECIFIED\020\000"
- + "\022\007\n\003AND\020\001\022\006\n\002OR\020\002\"\352\002\n\016PropertyFilter\0228\n\010"
- + "property\030\001 \001(\0132&.google.datastore.v1.Pro"
- + "pertyReference\0228\n\002op\030\002 \001(\0162,.google.data"
- + "store.v1.PropertyFilter.Operator\022)\n\005valu"
- + "e\030\003 \001(\0132\032.google.datastore.v1.Value\"\270\001\n\010"
- + "Operator\022\030\n\024OPERATOR_UNSPECIFIED\020\000\022\r\n\tLE"
- + "SS_THAN\020\001\022\026\n\022LESS_THAN_OR_EQUAL\020\002\022\020\n\014GRE"
- + "ATER_THAN\020\003\022\031\n\025GREATER_THAN_OR_EQUAL\020\004\022\t"
- + "\n\005EQUAL\020\005\022\006\n\002IN\020\006\022\r\n\tNOT_EQUAL\020\t\022\020\n\014HAS_"
- + "ANCESTOR\020\013\022\n\n\006NOT_IN\020\r\"\245\002\n\010GqlQuery\022\024\n\014q"
- + "uery_string\030\001 \001(\t\022\026\n\016allow_literals\030\002 \001("
- + "\010\022H\n\016named_bindings\030\005 \003(\01320.google.datas"
- + "tore.v1.GqlQuery.NamedBindingsEntry\022C\n\023p"
- + "ositional_bindings\030\004 \003(\0132&.google.datast"
- + "ore.v1.GqlQueryParameter\032\\\n\022NamedBinding"
- + "sEntry\022\013\n\003key\030\001 \001(\t\0225\n\005value\030\002 \001(\0132&.goo"
- + "gle.datastore.v1.GqlQueryParameter:\0028\001\"d"
- + "\n\021GqlQueryParameter\022+\n\005value\030\002 \001(\0132\032.goo"
- + "gle.datastore.v1.ValueH\000\022\020\n\006cursor\030\003 \001(\014"
- + "H\000B\020\n\016parameter_type\"\215\004\n\020QueryResultBatc"
- + "h\022\027\n\017skipped_results\030\006 \001(\005\022\026\n\016skipped_cu"
- + "rsor\030\003 \001(\014\022H\n\022entity_result_type\030\001 \001(\0162,"
- + ".google.datastore.v1.EntityResult.Result"
- + "Type\0229\n\016entity_results\030\002 \003(\0132!.google.da"
- + "tastore.v1.EntityResult\022\022\n\nend_cursor\030\004 "
- + "\001(\014\022K\n\014more_results\030\005 \001(\01625.google.datas"
- + "tore.v1.QueryResultBatch.MoreResultsType"
- + "\022\030\n\020snapshot_version\030\007 \001(\003\022-\n\tread_time\030"
- + "\010 \001(\0132\032.google.protobuf.Timestamp\"\230\001\n\017Mo"
- + "reResultsType\022!\n\035MORE_RESULTS_TYPE_UNSPE"
- + "CIFIED\020\000\022\020\n\014NOT_FINISHED\020\001\022\034\n\030MORE_RESUL"
- + "TS_AFTER_LIMIT\020\002\022\035\n\031MORE_RESULTS_AFTER_C"
- + "URSOR\020\004\022\023\n\017NO_MORE_RESULTS\020\003B\273\001\n\027com.goo"
- + "gle.datastore.v1B\nQueryProtoP\001Z;cloud.go"
- + "ogle.com/go/datastore/apiv1/datastorepb;"
- + "datastorepb\252\002\031Google.Cloud.Datastore.V1\312"
- + "\002\031Google\\Cloud\\Datastore\\V1\352\002\034Google::Cl"
- + "oud::Datastore::V1b\006proto3"
+ + "\030\014 \001(\0132\033.google.protobuf.Int32Value\022;\n\014f"
+ + "ind_nearest\030\r \001(\0132 .google.datastore.v1."
+ + "FindNearestB\003\340A\001\"\344\004\n\020AggregationQuery\0222\n"
+ + "\014nested_query\030\001 \001(\0132\032.google.datastore.v"
+ + "1.QueryH\000\022L\n\014aggregations\030\003 \003(\01321.google"
+ + ".datastore.v1.AggregationQuery.Aggregati"
+ + "onB\003\340A\001\032\277\003\n\013Aggregation\022H\n\005count\030\001 \001(\01327"
+ + ".google.datastore.v1.AggregationQuery.Ag"
+ + "gregation.CountH\000\022D\n\003sum\030\002 \001(\01325.google."
+ + "datastore.v1.AggregationQuery.Aggregatio"
+ + "n.SumH\000\022D\n\003avg\030\003 \001(\01325.google.datastore."
+ + "v1.AggregationQuery.Aggregation.AvgH\000\022\022\n"
+ + "\005alias\030\007 \001(\tB\003\340A\001\0328\n\005Count\022/\n\005up_to\030\001 \001("
+ + "\0132\033.google.protobuf.Int64ValueB\003\340A\001\032?\n\003S"
+ + "um\0228\n\010property\030\001 \001(\0132&.google.datastore."
+ + "v1.PropertyReference\032?\n\003Avg\0228\n\010property\030"
+ + "\001 \001(\0132&.google.datastore.v1.PropertyRefe"
+ + "renceB\n\n\010operatorB\014\n\nquery_type\"\036\n\016KindE"
+ + "xpression\022\014\n\004name\030\001 \001(\t\"!\n\021PropertyRefer"
+ + "ence\022\014\n\004name\030\002 \001(\t\"F\n\nProjection\0228\n\010prop"
+ + "erty\030\001 \001(\0132&.google.datastore.v1.Propert"
+ + "yReference\"\321\001\n\rPropertyOrder\0228\n\010property"
+ + "\030\001 \001(\0132&.google.datastore.v1.PropertyRef"
+ + "erence\022?\n\tdirection\030\002 \001(\0162,.google.datas"
+ + "tore.v1.PropertyOrder.Direction\"E\n\tDirec"
+ + "tion\022\031\n\025DIRECTION_UNSPECIFIED\020\000\022\r\n\tASCEN"
+ + "DING\020\001\022\016\n\nDESCENDING\020\002\"\231\001\n\006Filter\022@\n\020com"
+ + "posite_filter\030\001 \001(\0132$.google.datastore.v"
+ + "1.CompositeFilterH\000\022>\n\017property_filter\030\002"
+ + " \001(\0132#.google.datastore.v1.PropertyFilte"
+ + "rH\000B\r\n\013filter_type\"\261\001\n\017CompositeFilter\0229"
+ + "\n\002op\030\001 \001(\0162-.google.datastore.v1.Composi"
+ + "teFilter.Operator\022,\n\007filters\030\002 \003(\0132\033.goo"
+ + "gle.datastore.v1.Filter\"5\n\010Operator\022\030\n\024O"
+ + "PERATOR_UNSPECIFIED\020\000\022\007\n\003AND\020\001\022\006\n\002OR\020\002\"\352"
+ + "\002\n\016PropertyFilter\0228\n\010property\030\001 \001(\0132&.go"
+ + "ogle.datastore.v1.PropertyReference\0228\n\002o"
+ + "p\030\002 \001(\0162,.google.datastore.v1.PropertyFi"
+ + "lter.Operator\022)\n\005value\030\003 \001(\0132\032.google.da"
+ + "tastore.v1.Value\"\270\001\n\010Operator\022\030\n\024OPERATO"
+ + "R_UNSPECIFIED\020\000\022\r\n\tLESS_THAN\020\001\022\026\n\022LESS_T"
+ + "HAN_OR_EQUAL\020\002\022\020\n\014GREATER_THAN\020\003\022\031\n\025GREA"
+ + "TER_THAN_OR_EQUAL\020\004\022\t\n\005EQUAL\020\005\022\006\n\002IN\020\006\022\r"
+ + "\n\tNOT_EQUAL\020\t\022\020\n\014HAS_ANCESTOR\020\013\022\n\n\006NOT_I"
+ + "N\020\r\"\323\003\n\013FindNearest\022D\n\017vector_property\030\001"
+ + " \001(\0132&.google.datastore.v1.PropertyRefer"
+ + "enceB\003\340A\002\0225\n\014query_vector\030\002 \001(\0132\032.google"
+ + ".datastore.v1.ValueB\003\340A\002\022O\n\020distance_mea"
+ + "sure\030\003 \001(\01620.google.datastore.v1.FindNea"
+ + "rest.DistanceMeasureB\003\340A\002\022/\n\005limit\030\004 \001(\013"
+ + "2\033.google.protobuf.Int32ValueB\003\340A\002\022%\n\030di"
+ + "stance_result_property\030\005 \001(\tB\003\340A\001\022=\n\022dis"
+ + "tance_threshold\030\006 \001(\0132\034.google.protobuf."
+ + "DoubleValueB\003\340A\001\"_\n\017DistanceMeasure\022 \n\034D"
+ + "ISTANCE_MEASURE_UNSPECIFIED\020\000\022\r\n\tEUCLIDE"
+ + "AN\020\001\022\n\n\006COSINE\020\002\022\017\n\013DOT_PRODUCT\020\003\"\245\002\n\010Gq"
+ + "lQuery\022\024\n\014query_string\030\001 \001(\t\022\026\n\016allow_li"
+ + "terals\030\002 \001(\010\022H\n\016named_bindings\030\005 \003(\01320.g"
+ + "oogle.datastore.v1.GqlQuery.NamedBinding"
+ + "sEntry\022C\n\023positional_bindings\030\004 \003(\0132&.go"
+ + "ogle.datastore.v1.GqlQueryParameter\032\\\n\022N"
+ + "amedBindingsEntry\022\013\n\003key\030\001 \001(\t\0225\n\005value\030"
+ + "\002 \001(\0132&.google.datastore.v1.GqlQueryPara"
+ + "meter:\0028\001\"d\n\021GqlQueryParameter\022+\n\005value\030"
+ + "\002 \001(\0132\032.google.datastore.v1.ValueH\000\022\020\n\006c"
+ + "ursor\030\003 \001(\014H\000B\020\n\016parameter_type\"\215\004\n\020Quer"
+ + "yResultBatch\022\027\n\017skipped_results\030\006 \001(\005\022\026\n"
+ + "\016skipped_cursor\030\003 \001(\014\022H\n\022entity_result_t"
+ + "ype\030\001 \001(\0162,.google.datastore.v1.EntityRe"
+ + "sult.ResultType\0229\n\016entity_results\030\002 \003(\0132"
+ + "!.google.datastore.v1.EntityResult\022\022\n\nen"
+ + "d_cursor\030\004 \001(\014\022K\n\014more_results\030\005 \001(\01625.g"
+ + "oogle.datastore.v1.QueryResultBatch.More"
+ + "ResultsType\022\030\n\020snapshot_version\030\007 \001(\003\022-\n"
+ + "\tread_time\030\010 \001(\0132\032.google.protobuf.Times"
+ + "tamp\"\230\001\n\017MoreResultsType\022!\n\035MORE_RESULTS"
+ + "_TYPE_UNSPECIFIED\020\000\022\020\n\014NOT_FINISHED\020\001\022\034\n"
+ + "\030MORE_RESULTS_AFTER_LIMIT\020\002\022\035\n\031MORE_RESU"
+ + "LTS_AFTER_CURSOR\020\004\022\023\n\017NO_MORE_RESULTS\020\003B"
+ + "\273\001\n\027com.google.datastore.v1B\nQueryProtoP"
+ + "\001Z;cloud.google.com/go/datastore/apiv1/d"
+ + "atastorepb;datastorepb\252\002\031Google.Cloud.Da"
+ + "tastore.V1\312\002\031Google\\Cloud\\Datastore\\V1\352\002"
+ + "\034Google::Cloud::Datastore::V1b\006proto3"
};
descriptor =
com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(
@@ -232,6 +249,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
"EndCursor",
"Offset",
"Limit",
+ "FindNearest",
});
internal_static_google_datastore_v1_AggregationQuery_descriptor =
getDescriptor().getMessageTypes().get(2);
@@ -335,8 +353,21 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
new java.lang.String[] {
"Property", "Op", "Value",
});
- internal_static_google_datastore_v1_GqlQuery_descriptor =
+ internal_static_google_datastore_v1_FindNearest_descriptor =
getDescriptor().getMessageTypes().get(10);
+ internal_static_google_datastore_v1_FindNearest_fieldAccessorTable =
+ new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
+ internal_static_google_datastore_v1_FindNearest_descriptor,
+ new java.lang.String[] {
+ "VectorProperty",
+ "QueryVector",
+ "DistanceMeasure",
+ "Limit",
+ "DistanceResultProperty",
+ "DistanceThreshold",
+ });
+ internal_static_google_datastore_v1_GqlQuery_descriptor =
+ getDescriptor().getMessageTypes().get(11);
internal_static_google_datastore_v1_GqlQuery_fieldAccessorTable =
new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_google_datastore_v1_GqlQuery_descriptor,
@@ -352,7 +383,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
"Key", "Value",
});
internal_static_google_datastore_v1_GqlQueryParameter_descriptor =
- getDescriptor().getMessageTypes().get(11);
+ getDescriptor().getMessageTypes().get(12);
internal_static_google_datastore_v1_GqlQueryParameter_fieldAccessorTable =
new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_google_datastore_v1_GqlQueryParameter_descriptor,
@@ -360,7 +391,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
"Value", "Cursor", "ParameterType",
});
internal_static_google_datastore_v1_QueryResultBatch_descriptor =
- getDescriptor().getMessageTypes().get(12);
+ getDescriptor().getMessageTypes().get(13);
internal_static_google_datastore_v1_QueryResultBatch_fieldAccessorTable =
new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_google_datastore_v1_QueryResultBatch_descriptor,
diff --git a/proto-google-cloud-datastore-v1/src/main/proto/google/datastore/v1/query.proto b/proto-google-cloud-datastore-v1/src/main/proto/google/datastore/v1/query.proto
index 5ec0eea61..3c2e8ae66 100644
--- a/proto-google-cloud-datastore-v1/src/main/proto/google/datastore/v1/query.proto
+++ b/proto-google-cloud-datastore-v1/src/main/proto/google/datastore/v1/query.proto
@@ -82,6 +82,15 @@ message EntityResult {
}
// A query for entities.
+//
+// The query stages are executed in the following order:
+// 1. kind
+// 2. filter
+// 3. projection
+// 4. order + start_cursor + end_cursor
+// 5. offset
+// 6. limit
+// 7. find_nearest
message Query {
// The projection to return. Defaults to returning all properties.
repeated Projection projection = 2;
@@ -127,6 +136,13 @@ message Query {
// Unspecified is interpreted as no limit.
// Must be >= 0 if specified.
google.protobuf.Int32Value limit = 12;
+
+ // Optional. A potential Nearest Neighbors Search.
+ //
+ // Applies after all other filters and ordering.
+ //
+ // Finds the closest vector embeddings to the given query vector.
+ FindNearest find_nearest = 13 [(google.api.field_behavior) = OPTIONAL];
}
// Datastore query for running an aggregation over a
@@ -436,6 +452,70 @@ message PropertyFilter {
Value value = 3;
}
+// Nearest Neighbors search config. The ordering provided by FindNearest
+// supersedes the order_by stage. If multiple documents have the same vector
+// distance, the returned document order is not guaranteed to be stable between
+// queries.
+message FindNearest {
+ // The distance measure to use when comparing vectors.
+ enum DistanceMeasure {
+ // Should not be set.
+ DISTANCE_MEASURE_UNSPECIFIED = 0;
+
+ // Measures the EUCLIDEAN distance between the vectors. See
+ // [Euclidean](https://en.wikipedia.org/wiki/Euclidean_distance) to learn
+ // more. The resulting distance decreases the more similar two vectors are.
+ EUCLIDEAN = 1;
+
+ // COSINE distance compares vectors based on the angle between them, which
+ // allows you to measure similarity that isn't based on the vectors
+ // magnitude. We recommend using DOT_PRODUCT with unit normalized vectors
+ // instead of COSINE distance, which is mathematically equivalent with
+ // better performance. See [Cosine
+ // Similarity](https://en.wikipedia.org/wiki/Cosine_similarity) to learn
+ // more about COSINE similarity and COSINE distance. The resulting COSINE
+ // distance decreases the more similar two vectors are.
+ COSINE = 2;
+
+ // Similar to cosine but is affected by the magnitude of the vectors. See
+ // [Dot Product](https://en.wikipedia.org/wiki/Dot_product) to learn more.
+ // The resulting distance increases the more similar two vectors are.
+ DOT_PRODUCT = 3;
+ }
+
+ // Required. An indexed vector property to search upon. Only documents which
+ // contain vectors whose dimensionality match the query_vector can be
+ // returned.
+ PropertyReference vector_property = 1
+ [(google.api.field_behavior) = REQUIRED];
+
+ // Required. The query vector that we are searching on. Must be a vector of no
+ // more than 2048 dimensions.
+ Value query_vector = 2 [(google.api.field_behavior) = REQUIRED];
+
+ // Required. The Distance Measure to use, required.
+ DistanceMeasure distance_measure = 3 [(google.api.field_behavior) = REQUIRED];
+
+ // Required. The number of nearest neighbors to return. Must be a positive
+ // integer of no more than 100.
+ google.protobuf.Int32Value limit = 4 [(google.api.field_behavior) = REQUIRED];
+
+ // Optional. Optional name of the field to output the result of the vector
+ // distance calculation. Must conform to [entity
+ // property][google.datastore.v1.Entity.properties] limitations.
+ string distance_result_property = 5 [(google.api.field_behavior) = OPTIONAL];
+
+ // Optional. Option to specify a threshold for which no less similar documents
+ // will be returned. The behavior of the specified `distance_measure` will
+ // affect the meaning of the distance threshold. Since DOT_PRODUCT distances
+ // increase when the vectors are more similar, the comparison is inverted.
+ //
+ // For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold
+ // For DOT_PRODUCT: WHERE distance >= distance_threshold
+ google.protobuf.DoubleValue distance_threshold = 6
+ [(google.api.field_behavior) = OPTIONAL];
+}
+
// A [GQL
// query](https://cloud.google.com/datastore/docs/apis/gql/gql_reference).
message GqlQuery {
diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml
index c39bbf20b..30cba8255 100644
--- a/samples/install-without-bom/pom.xml
+++ b/samples/install-without-bom/pom.xml
@@ -29,7 +29,7 @@