From 3512ba2f1bcd358e3c39c36944e05873b3f25f51 Mon Sep 17 00:00:00 2001 From: cloud-java-bot <122572305+cloud-java-bot@users.noreply.github.com> Date: Tue, 15 Oct 2024 13:29:28 -0400 Subject: [PATCH 1/9] chore: Update generation configuration at Tue Oct 15 02:24:25 UTC 2024 (#1618) * chore: Update generation configuration at Thu Oct 10 02:23:46 UTC 2024 * chore: Update generation configuration at Fri Oct 11 02:23:15 UTC 2024 * chore: generate libraries at Fri Oct 11 02:23:38 UTC 2024 * chore: Update generation configuration at Sat Oct 12 02:21:27 UTC 2024 * chore: generate libraries at Sat Oct 12 02:21:51 UTC 2024 * chore: Update generation configuration at Sun Oct 13 02:25:36 UTC 2024 * chore: Update generation configuration at Tue Oct 15 02:24:25 UTC 2024 --- generation_config.yaml | 2 +- .../com/google/datastore/v1/FindNearest.java | 2272 +++++++++++++++++ .../datastore/v1/FindNearestOrBuilder.java | 269 ++ .../java/com/google/datastore/v1/Query.java | 359 +++ .../google/datastore/v1/QueryOrBuilder.java | 53 + .../com/google/datastore/v1/QueryProto.java | 181 +- .../proto/google/datastore/v1/query.proto | 80 + 7 files changed, 3140 insertions(+), 76 deletions(-) create mode 100644 proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/FindNearest.java create mode 100644 proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/FindNearestOrBuilder.java diff --git a/generation_config.yaml b/generation_config.yaml index 44eb5d8aa..3e00e550d 100644 --- a/generation_config.yaml +++ b/generation_config.yaml @@ -1,5 +1,5 @@ gapic_generator_version: 2.47.0 -googleapis_commitish: 8692273ae7e0ef95d264e1bb8bcb900fa950674f +googleapis_commitish: f78cd2f7943b9a2eb9734e56a8f3428da75917e2 libraries_bom_version: 26.48.0 libraries: - api_shortname: datastore diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/FindNearest.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/FindNearest.java new file mode 100644 index 000000000..999b5b1f2 --- /dev/null +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/FindNearest.java @@ -0,0 +1,2272 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/datastore/v1/query.proto + +// Protobuf Java Version: 3.25.5 +package com.google.datastore.v1; + +/** + * + * + *
+ * 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 {
From d13d9c63ef87a0115f70b85a6d6b60ab3ff5a222 Mon Sep 17 00:00:00 2001
From: cloud-java-bot <122572305+cloud-java-bot@users.noreply.github.com>
Date: Fri, 18 Oct 2024 21:10:36 -0400
Subject: [PATCH 2/9] chore: Update generation configuration at Fri Oct 18
02:24:22 UTC 2024 (#1625)
* chore: Update generation configuration at Wed Oct 16 02:24:55 UTC 2024
* chore: Update generation configuration at Thu Oct 17 02:23:50 UTC 2024
* chore: generate libraries at Thu Oct 17 02:24:19 UTC 2024
* chore: Update generation configuration at Fri Oct 18 02:24:22 UTC 2024
---
README.md | 2 +-
generation_config.yaml | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index e76f6832b..a6a76d6c5 100644
--- a/README.md
+++ b/README.md
@@ -49,7 +49,7 @@ If you are using Maven without the BOM, add this to your dependencies:
If you are using Gradle 5.x or later, add this to your dependencies:
```Groovy
-implementation platform('com.google.cloud:libraries-bom:26.48.0')
+implementation platform('com.google.cloud:libraries-bom:26.49.0')
implementation 'com.google.cloud:google-cloud-datastore'
```
diff --git a/generation_config.yaml b/generation_config.yaml
index 3e00e550d..570a4341f 100644
--- a/generation_config.yaml
+++ b/generation_config.yaml
@@ -1,6 +1,6 @@
gapic_generator_version: 2.47.0
-googleapis_commitish: f78cd2f7943b9a2eb9734e56a8f3428da75917e2
-libraries_bom_version: 26.48.0
+googleapis_commitish: 5ebb5c1e3d2953efd05c068b27138098eecc8308
+libraries_bom_version: 26.49.0
libraries:
- api_shortname: datastore
name_pretty: Cloud Datastore
From e3c413880018e1866c46b08fcd4e2c3110a15264 Mon Sep 17 00:00:00 2001
From: cloud-java-bot <122572305+cloud-java-bot@users.noreply.github.com>
Date: Tue, 22 Oct 2024 12:52:30 -0400
Subject: [PATCH 3/9] chore: Update generation configuration at Tue Oct 22
02:24:17 UTC 2024 (#1626)
* chore: Update generation configuration at Sat Oct 19 02:22:40 UTC 2024
* chore: Update generation configuration at Tue Oct 22 02:24:17 UTC 2024
---
generation_config.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/generation_config.yaml b/generation_config.yaml
index 570a4341f..f8e731ddc 100644
--- a/generation_config.yaml
+++ b/generation_config.yaml
@@ -1,5 +1,5 @@
gapic_generator_version: 2.47.0
-googleapis_commitish: 5ebb5c1e3d2953efd05c068b27138098eecc8308
+googleapis_commitish: beea48a164c2a8cc8485185c3a4f56c587090e1a
libraries_bom_version: 26.49.0
libraries:
- api_shortname: datastore
From af7de6526786783a3f4173eaa17d25a6aa52d4fa Mon Sep 17 00:00:00 2001
From: "release-please[bot]"
<55107282+release-please[bot]@users.noreply.github.com>
Date: Wed, 23 Oct 2024 18:58:24 +0000
Subject: [PATCH 4/9] chore(main): release 2.23.1-SNAPSHOT (#1623)
:robot: I have created a release *beep* *boop*
---
### Updating meta-information for bleeding-edge SNAPSHOT release.
---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
---
datastore-v1-proto-client/pom.xml | 4 ++--
google-cloud-datastore-bom/pom.xml | 10 +++++-----
google-cloud-datastore/pom.xml | 4 ++--
grpc-google-cloud-datastore-admin-v1/pom.xml | 4 ++--
pom.xml | 12 ++++++------
proto-google-cloud-datastore-admin-v1/pom.xml | 4 ++--
proto-google-cloud-datastore-v1/pom.xml | 4 ++--
samples/snapshot/pom.xml | 2 +-
versions.txt | 12 ++++++------
9 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/datastore-v1-proto-client/pom.xml b/datastore-v1-proto-client/pom.xml
index 723d37a51..6e3f7cfc9 100644
--- a/datastore-v1-proto-client/pom.xml
+++ b/datastore-v1-proto-client/pom.xml
@@ -19,12 +19,12 @@