+ implements
+ // @@protoc_insertion_point(builder_implements:google.datastore.v1.FindNearest)
+ com.google.datastore.v1.FindNearestOrBuilder {
+ 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);
+ }
+
+ // Construct using com.google.datastore.v1.FindNearest.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {
+ getVectorPropertyFieldBuilder();
+ getQueryVectorFieldBuilder();
+ getLimitFieldBuilder();
+ getDistanceThresholdFieldBuilder();
+ }
+ }
+
+ @java.lang.Override
+ public Builder clear() {
+ super.clear();
+ bitField0_ = 0;
+ vectorProperty_ = null;
+ if (vectorPropertyBuilder_ != null) {
+ vectorPropertyBuilder_.dispose();
+ vectorPropertyBuilder_ = null;
+ }
+ queryVector_ = null;
+ if (queryVectorBuilder_ != null) {
+ queryVectorBuilder_.dispose();
+ queryVectorBuilder_ = null;
+ }
+ distanceMeasure_ = 0;
+ limit_ = null;
+ if (limitBuilder_ != null) {
+ limitBuilder_.dispose();
+ limitBuilder_ = null;
+ }
+ distanceResultProperty_ = "";
+ distanceThreshold_ = null;
+ if (distanceThresholdBuilder_ != null) {
+ distanceThresholdBuilder_.dispose();
+ distanceThresholdBuilder_ = null;
+ }
+ return this;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
+ return com.google.datastore.v1.QueryProto
+ .internal_static_google_datastore_v1_FindNearest_descriptor;
+ }
+
+ @java.lang.Override
+ public com.google.datastore.v1.FindNearest getDefaultInstanceForType() {
+ return com.google.datastore.v1.FindNearest.getDefaultInstance();
+ }
+
+ @java.lang.Override
+ public com.google.datastore.v1.FindNearest build() {
+ com.google.datastore.v1.FindNearest result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ @java.lang.Override
+ public com.google.datastore.v1.FindNearest buildPartial() {
+ com.google.datastore.v1.FindNearest result = new com.google.datastore.v1.FindNearest(this);
+ if (bitField0_ != 0) {
+ buildPartial0(result);
+ }
+ onBuilt();
+ return result;
+ }
+
+ private void buildPartial0(com.google.datastore.v1.FindNearest result) {
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) != 0)) {
+ result.vectorProperty_ =
+ vectorPropertyBuilder_ == null ? vectorProperty_ : vectorPropertyBuilder_.build();
+ to_bitField0_ |= 0x00000001;
+ }
+ if (((from_bitField0_ & 0x00000002) != 0)) {
+ result.queryVector_ =
+ queryVectorBuilder_ == null ? queryVector_ : queryVectorBuilder_.build();
+ to_bitField0_ |= 0x00000002;
+ }
+ if (((from_bitField0_ & 0x00000004) != 0)) {
+ result.distanceMeasure_ = distanceMeasure_;
+ }
+ if (((from_bitField0_ & 0x00000008) != 0)) {
+ result.limit_ = limitBuilder_ == null ? limit_ : limitBuilder_.build();
+ to_bitField0_ |= 0x00000004;
+ }
+ if (((from_bitField0_ & 0x00000010) != 0)) {
+ result.distanceResultProperty_ = distanceResultProperty_;
+ }
+ if (((from_bitField0_ & 0x00000020) != 0)) {
+ result.distanceThreshold_ =
+ distanceThresholdBuilder_ == null
+ ? distanceThreshold_
+ : distanceThresholdBuilder_.build();
+ to_bitField0_ |= 0x00000008;
+ }
+ result.bitField0_ |= to_bitField0_;
+ }
+
+ @java.lang.Override
+ public Builder clone() {
+ return super.clone();
+ }
+
+ @java.lang.Override
+ public Builder setField(
+ com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
+ return super.setField(field, value);
+ }
+
+ @java.lang.Override
+ public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
+ return super.clearField(field);
+ }
+
+ @java.lang.Override
+ public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
+ return super.clearOneof(oneof);
+ }
+
+ @java.lang.Override
+ public Builder setRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
+ return super.setRepeatedField(field, index, value);
+ }
+
+ @java.lang.Override
+ public Builder addRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
+ return super.addRepeatedField(field, value);
+ }
+
+ @java.lang.Override
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof com.google.datastore.v1.FindNearest) {
+ return mergeFrom((com.google.datastore.v1.FindNearest) other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(com.google.datastore.v1.FindNearest other) {
+ if (other == com.google.datastore.v1.FindNearest.getDefaultInstance()) return this;
+ if (other.hasVectorProperty()) {
+ mergeVectorProperty(other.getVectorProperty());
+ }
+ if (other.hasQueryVector()) {
+ mergeQueryVector(other.getQueryVector());
+ }
+ if (other.distanceMeasure_ != 0) {
+ setDistanceMeasureValue(other.getDistanceMeasureValue());
+ }
+ if (other.hasLimit()) {
+ mergeLimit(other.getLimit());
+ }
+ if (!other.getDistanceResultProperty().isEmpty()) {
+ distanceResultProperty_ = other.distanceResultProperty_;
+ bitField0_ |= 0x00000010;
+ onChanged();
+ }
+ if (other.hasDistanceThreshold()) {
+ mergeDistanceThreshold(other.getDistanceThreshold());
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ onChanged();
+ return this;
+ }
+
+ @java.lang.Override
+ public final boolean isInitialized() {
+ return true;
+ }
+
+ @java.lang.Override
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ if (extensionRegistry == null) {
+ throw new java.lang.NullPointerException();
+ }
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ case 10:
+ {
+ input.readMessage(getVectorPropertyFieldBuilder().getBuilder(), extensionRegistry);
+ bitField0_ |= 0x00000001;
+ break;
+ } // case 10
+ case 18:
+ {
+ input.readMessage(getQueryVectorFieldBuilder().getBuilder(), extensionRegistry);
+ bitField0_ |= 0x00000002;
+ break;
+ } // case 18
+ case 24:
+ {
+ distanceMeasure_ = input.readEnum();
+ bitField0_ |= 0x00000004;
+ break;
+ } // case 24
+ case 34:
+ {
+ input.readMessage(getLimitFieldBuilder().getBuilder(), extensionRegistry);
+ bitField0_ |= 0x00000008;
+ break;
+ } // case 34
+ case 42:
+ {
+ distanceResultProperty_ = input.readStringRequireUtf8();
+ bitField0_ |= 0x00000010;
+ break;
+ } // case 42
+ case 50:
+ {
+ input.readMessage(
+ getDistanceThresholdFieldBuilder().getBuilder(), extensionRegistry);
+ bitField0_ |= 0x00000020;
+ break;
+ } // case 50
+ default:
+ {
+ if (!super.parseUnknownField(input, extensionRegistry, tag)) {
+ done = true; // was an endgroup tag
+ }
+ break;
+ } // default:
+ } // switch (tag)
+ } // while (!done)
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.unwrapIOException();
+ } finally {
+ onChanged();
+ } // finally
+ return this;
+ }
+
+ private int bitField0_;
+
+ private com.google.datastore.v1.PropertyReference vectorProperty_;
+ private com.google.protobuf.SingleFieldBuilderV3<
+ com.google.datastore.v1.PropertyReference,
+ com.google.datastore.v1.PropertyReference.Builder,
+ com.google.datastore.v1.PropertyReferenceOrBuilder>
+ vectorPropertyBuilder_;
+ /**
+ *
+ *
+ *
+ * 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 PARSER =
+ new com.google.protobuf.AbstractParser() {
+ @java.lang.Override
+ public FindNearest parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ Builder builder = newBuilder();
+ try {
+ builder.mergeFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(builder.buildPartial());
+ } catch (com.google.protobuf.UninitializedMessageException e) {
+ throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(e)
+ .setUnfinishedMessage(builder.buildPartial());
+ }
+ return builder.buildPartial();
+ }
+ };
+
+ public static com.google.protobuf.Parser parser() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Parser getParserForType() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public com.google.datastore.v1.FindNearest getDefaultInstanceForType() {
+ return DEFAULT_INSTANCE;
+ }
+}
diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/FindNearestOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/FindNearestOrBuilder.java
new file mode 100644
index 000000000..ac7b994a6
--- /dev/null
+++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/FindNearestOrBuilder.java
@@ -0,0 +1,269 @@
+/*
+ * 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;
+
+public interface FindNearestOrBuilder
+ extends
+ // @@protoc_insertion_point(interface_extends:google.datastore.v1.FindNearest)
+ com.google.protobuf.MessageOrBuilder {
+
+ /**
+ *
+ *
+ *
+ * Required. An indexed vector property to search upon. Only documents which
+ * contain vectors whose dimensionality match the query_vector can be
+ * returned.
+ *
+ *
+ *
+ * .google.datastore.v1.PropertyReference vector_property = 1 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return Whether the vectorProperty field is set.
+ */
+ boolean hasVectorProperty();
+ /**
+ *
+ *
+ *
+ * Required. An indexed vector property to search upon. Only documents which
+ * contain vectors whose dimensionality match the query_vector can be
+ * returned.
+ *
+ *
+ *
+ * .google.datastore.v1.PropertyReference vector_property = 1 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return The vectorProperty.
+ */
+ com.google.datastore.v1.PropertyReference getVectorProperty();
+ /**
+ *
+ *
+ *
+ * Required. An indexed vector property to search upon. Only documents which
+ * contain vectors whose dimensionality match the query_vector can be
+ * returned.
+ *
+ *
+ *
+ * .google.datastore.v1.PropertyReference vector_property = 1 [(.google.api.field_behavior) = REQUIRED];
+ *
+ */
+ com.google.datastore.v1.PropertyReferenceOrBuilder getVectorPropertyOrBuilder();
+
+ /**
+ *
+ *
+ *
+ * Required. The query vector that we are searching on. Must be a vector of no
+ * more than 2048 dimensions.
+ *
+ *
+ * .google.datastore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return Whether the queryVector field is set.
+ */
+ boolean hasQueryVector();
+ /**
+ *
+ *
+ *
+ * Required. The query vector that we are searching on. Must be a vector of no
+ * more than 2048 dimensions.
+ *
+ *
+ * .google.datastore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return The queryVector.
+ */
+ com.google.datastore.v1.Value getQueryVector();
+ /**
+ *
+ *
+ *
+ * Required. The query vector that we are searching on. Must be a vector of no
+ * more than 2048 dimensions.
+ *
+ *
+ * .google.datastore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ */
+ com.google.datastore.v1.ValueOrBuilder getQueryVectorOrBuilder();
+
+ /**
+ *
+ *
+ *
+ * Required. The Distance Measure to use, required.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return The enum numeric value on the wire for distanceMeasure.
+ */
+ int getDistanceMeasureValue();
+ /**
+ *
+ *
+ *
+ * Required. The Distance Measure to use, required.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return The distanceMeasure.
+ */
+ com.google.datastore.v1.FindNearest.DistanceMeasure getDistanceMeasure();
+
+ /**
+ *
+ *
+ *
+ * Required. The number of nearest neighbors to return. Must be a positive
+ * integer of no more than 100.
+ *
+ *
+ * .google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];
+ *
+ * @return Whether the limit field is set.
+ */
+ boolean hasLimit();
+ /**
+ *
+ *
+ *
+ * Required. The number of nearest neighbors to return. Must be a positive
+ * integer of no more than 100.
+ *
+ *
+ * .google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];
+ *
+ * @return The limit.
+ */
+ com.google.protobuf.Int32Value getLimit();
+ /**
+ *
+ *
+ *
+ * Required. The number of nearest neighbors to return. Must be a positive
+ * integer of no more than 100.
+ *
+ *
+ * .google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];
+ */
+ com.google.protobuf.Int32ValueOrBuilder getLimitOrBuilder();
+
+ /**
+ *
+ *
+ *
+ * Optional. Optional name of the field to output the result of the vector
+ * distance calculation. Must conform to [entity
+ * property][google.datastore.v1.Entity.properties] limitations.
+ *
+ *
+ * string distance_result_property = 5 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ * @return The distanceResultProperty.
+ */
+ java.lang.String getDistanceResultProperty();
+ /**
+ *
+ *
+ *
+ * Optional. Optional name of the field to output the result of the vector
+ * distance calculation. Must conform to [entity
+ * property][google.datastore.v1.Entity.properties] limitations.
+ *
+ *
+ * string distance_result_property = 5 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ * @return The bytes for distanceResultProperty.
+ */
+ com.google.protobuf.ByteString getDistanceResultPropertyBytes();
+
+ /**
+ *
+ *
+ *
+ * Optional. Option to specify a threshold for which no less similar documents
+ * will be returned. The behavior of the specified `distance_measure` will
+ * affect the meaning of the distance threshold. Since DOT_PRODUCT distances
+ * increase when the vectors are more similar, the comparison is inverted.
+ *
+ * For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold
+ * For DOT_PRODUCT: WHERE distance >= distance_threshold
+ *
+ *
+ *
+ * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ *
+ * @return Whether the distanceThreshold field is set.
+ */
+ boolean hasDistanceThreshold();
+ /**
+ *
+ *
+ *
+ * Optional. Option to specify a threshold for which no less similar documents
+ * will be returned. The behavior of the specified `distance_measure` will
+ * affect the meaning of the distance threshold. Since DOT_PRODUCT distances
+ * increase when the vectors are more similar, the comparison is inverted.
+ *
+ * For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold
+ * For DOT_PRODUCT: WHERE distance >= distance_threshold
+ *
+ *
+ *
+ * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ *
+ * @return The distanceThreshold.
+ */
+ com.google.protobuf.DoubleValue getDistanceThreshold();
+ /**
+ *
+ *
+ *
+ * Optional. Option to specify a threshold for which no less similar documents
+ * will be returned. The behavior of the specified `distance_measure` will
+ * affect the meaning of the distance threshold. Since DOT_PRODUCT distances
+ * increase when the vectors are more similar, the comparison is inverted.
+ *
+ * For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold
+ * For DOT_PRODUCT: WHERE distance >= distance_threshold
+ *
+ *
+ *
+ * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ */
+ com.google.protobuf.DoubleValueOrBuilder getDistanceThresholdOrBuilder();
+}
diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Query.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Query.java
index 2c0c40f79..25fba4c89 100644
--- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Query.java
+++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Query.java
@@ -24,6 +24,15 @@
*
*
* A query for entities.
+ *
+ * The query stages are executed in the following order:
+ * 1. kind
+ * 2. filter
+ * 3. projection
+ * 4. order + start_cursor + end_cursor
+ * 5. offset
+ * 6. limit
+ * 7. find_nearest
*
*
* Protobuf type {@code google.datastore.v1.Query}
@@ -553,6 +562,74 @@ public com.google.protobuf.Int32ValueOrBuilder getLimitOrBuilder() {
return limit_ == null ? com.google.protobuf.Int32Value.getDefaultInstance() : limit_;
}
+ public static final int FIND_NEAREST_FIELD_NUMBER = 13;
+ private com.google.datastore.v1.FindNearest findNearest_;
+ /**
+ *
+ *
+ *
+ * Optional. A potential Nearest Neighbors Search.
+ *
+ * Applies after all other filters and ordering.
+ *
+ * Finds the closest vector embeddings to the given query vector.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ *
+ * @return Whether the findNearest field is set.
+ */
+ @java.lang.Override
+ public boolean hasFindNearest() {
+ return ((bitField0_ & 0x00000004) != 0);
+ }
+ /**
+ *
+ *
+ *
+ * Optional. A potential Nearest Neighbors Search.
+ *
+ * Applies after all other filters and ordering.
+ *
+ * Finds the closest vector embeddings to the given query vector.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ *
+ * @return The findNearest.
+ */
+ @java.lang.Override
+ public com.google.datastore.v1.FindNearest getFindNearest() {
+ return findNearest_ == null
+ ? com.google.datastore.v1.FindNearest.getDefaultInstance()
+ : findNearest_;
+ }
+ /**
+ *
+ *
+ *
+ * Optional. A potential Nearest Neighbors Search.
+ *
+ * Applies after all other filters and ordering.
+ *
+ * Finds the closest vector embeddings to the given query vector.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ */
+ @java.lang.Override
+ public com.google.datastore.v1.FindNearestOrBuilder getFindNearestOrBuilder() {
+ return findNearest_ == null
+ ? com.google.datastore.v1.FindNearest.getDefaultInstance()
+ : findNearest_;
+ }
+
private byte memoizedIsInitialized = -1;
@java.lang.Override
@@ -594,6 +671,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io
if (((bitField0_ & 0x00000002) != 0)) {
output.writeMessage(12, getLimit());
}
+ if (((bitField0_ & 0x00000004) != 0)) {
+ output.writeMessage(13, getFindNearest());
+ }
getUnknownFields().writeTo(output);
}
@@ -630,6 +710,9 @@ public int getSerializedSize() {
if (((bitField0_ & 0x00000002) != 0)) {
size += com.google.protobuf.CodedOutputStream.computeMessageSize(12, getLimit());
}
+ if (((bitField0_ & 0x00000004) != 0)) {
+ size += com.google.protobuf.CodedOutputStream.computeMessageSize(13, getFindNearest());
+ }
size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
@@ -660,6 +743,10 @@ public boolean equals(final java.lang.Object obj) {
if (hasLimit()) {
if (!getLimit().equals(other.getLimit())) return false;
}
+ if (hasFindNearest() != other.hasFindNearest()) return false;
+ if (hasFindNearest()) {
+ if (!getFindNearest().equals(other.getFindNearest())) return false;
+ }
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
@@ -701,6 +788,10 @@ public int hashCode() {
hash = (37 * hash) + LIMIT_FIELD_NUMBER;
hash = (53 * hash) + getLimit().hashCode();
}
+ if (hasFindNearest()) {
+ hash = (37 * hash) + FIND_NEAREST_FIELD_NUMBER;
+ hash = (53 * hash) + getFindNearest().hashCode();
+ }
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
@@ -805,6 +896,15 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build
*
*
* A query for entities.
+ *
+ * The query stages are executed in the following order:
+ * 1. kind
+ * 2. filter
+ * 3. projection
+ * 4. order + start_cursor + end_cursor
+ * 5. offset
+ * 6. limit
+ * 7. find_nearest
*
*
* Protobuf type {@code google.datastore.v1.Query}
@@ -845,6 +945,7 @@ private void maybeForceBuilderInitialization() {
getOrderFieldBuilder();
getDistinctOnFieldBuilder();
getLimitFieldBuilder();
+ getFindNearestFieldBuilder();
}
}
@@ -893,6 +994,11 @@ public Builder clear() {
limitBuilder_.dispose();
limitBuilder_ = null;
}
+ findNearest_ = null;
+ if (findNearestBuilder_ != null) {
+ findNearestBuilder_.dispose();
+ findNearestBuilder_ = null;
+ }
return this;
}
@@ -986,6 +1092,11 @@ private void buildPartial0(com.google.datastore.v1.Query result) {
result.limit_ = limitBuilder_ == null ? limit_ : limitBuilder_.build();
to_bitField0_ |= 0x00000002;
}
+ if (((from_bitField0_ & 0x00000200) != 0)) {
+ result.findNearest_ =
+ findNearestBuilder_ == null ? findNearest_ : findNearestBuilder_.build();
+ to_bitField0_ |= 0x00000004;
+ }
result.bitField0_ |= to_bitField0_;
}
@@ -1157,6 +1268,9 @@ public Builder mergeFrom(com.google.datastore.v1.Query other) {
if (other.hasLimit()) {
mergeLimit(other.getLimit());
}
+ if (other.hasFindNearest()) {
+ mergeFindNearest(other.getFindNearest());
+ }
this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
@@ -1265,6 +1379,12 @@ public Builder mergeFrom(
bitField0_ |= 0x00000100;
break;
} // case 98
+ case 106:
+ {
+ input.readMessage(getFindNearestFieldBuilder().getBuilder(), extensionRegistry);
+ bitField0_ |= 0x00000200;
+ break;
+ } // case 106
default:
{
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
@@ -3396,6 +3516,245 @@ public com.google.protobuf.Int32ValueOrBuilder getLimitOrBuilder() {
return limitBuilder_;
}
+ private com.google.datastore.v1.FindNearest findNearest_;
+ private com.google.protobuf.SingleFieldBuilderV3<
+ com.google.datastore.v1.FindNearest,
+ com.google.datastore.v1.FindNearest.Builder,
+ com.google.datastore.v1.FindNearestOrBuilder>
+ findNearestBuilder_;
+ /**
+ *
+ *
+ *
+ * Optional. A potential Nearest Neighbors Search.
+ *
+ * Applies after all other filters and ordering.
+ *
+ * Finds the closest vector embeddings to the given query vector.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ *
+ * @return Whether the findNearest field is set.
+ */
+ public boolean hasFindNearest() {
+ return ((bitField0_ & 0x00000200) != 0);
+ }
+ /**
+ *
+ *
+ *
+ * Optional. A potential Nearest Neighbors Search.
+ *
+ * Applies after all other filters and ordering.
+ *
+ * Finds the closest vector embeddings to the given query vector.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ *
+ * @return The findNearest.
+ */
+ public com.google.datastore.v1.FindNearest getFindNearest() {
+ if (findNearestBuilder_ == null) {
+ return findNearest_ == null
+ ? com.google.datastore.v1.FindNearest.getDefaultInstance()
+ : findNearest_;
+ } else {
+ return findNearestBuilder_.getMessage();
+ }
+ }
+ /**
+ *
+ *
+ *
+ * Optional. A potential Nearest Neighbors Search.
+ *
+ * Applies after all other filters and ordering.
+ *
+ * Finds the closest vector embeddings to the given query vector.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ */
+ public Builder setFindNearest(com.google.datastore.v1.FindNearest value) {
+ if (findNearestBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ findNearest_ = value;
+ } else {
+ findNearestBuilder_.setMessage(value);
+ }
+ bitField0_ |= 0x00000200;
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Optional. A potential Nearest Neighbors Search.
+ *
+ * Applies after all other filters and ordering.
+ *
+ * Finds the closest vector embeddings to the given query vector.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ */
+ public Builder setFindNearest(com.google.datastore.v1.FindNearest.Builder builderForValue) {
+ if (findNearestBuilder_ == null) {
+ findNearest_ = builderForValue.build();
+ } else {
+ findNearestBuilder_.setMessage(builderForValue.build());
+ }
+ bitField0_ |= 0x00000200;
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Optional. A potential Nearest Neighbors Search.
+ *
+ * Applies after all other filters and ordering.
+ *
+ * Finds the closest vector embeddings to the given query vector.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ */
+ public Builder mergeFindNearest(com.google.datastore.v1.FindNearest value) {
+ if (findNearestBuilder_ == null) {
+ if (((bitField0_ & 0x00000200) != 0)
+ && findNearest_ != null
+ && findNearest_ != com.google.datastore.v1.FindNearest.getDefaultInstance()) {
+ getFindNearestBuilder().mergeFrom(value);
+ } else {
+ findNearest_ = value;
+ }
+ } else {
+ findNearestBuilder_.mergeFrom(value);
+ }
+ if (findNearest_ != null) {
+ bitField0_ |= 0x00000200;
+ onChanged();
+ }
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Optional. A potential Nearest Neighbors Search.
+ *
+ * Applies after all other filters and ordering.
+ *
+ * Finds the closest vector embeddings to the given query vector.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ */
+ public Builder clearFindNearest() {
+ bitField0_ = (bitField0_ & ~0x00000200);
+ findNearest_ = null;
+ if (findNearestBuilder_ != null) {
+ findNearestBuilder_.dispose();
+ findNearestBuilder_ = null;
+ }
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Optional. A potential Nearest Neighbors Search.
+ *
+ * Applies after all other filters and ordering.
+ *
+ * Finds the closest vector embeddings to the given query vector.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ */
+ public com.google.datastore.v1.FindNearest.Builder getFindNearestBuilder() {
+ bitField0_ |= 0x00000200;
+ onChanged();
+ return getFindNearestFieldBuilder().getBuilder();
+ }
+ /**
+ *
+ *
+ *
+ * Optional. A potential Nearest Neighbors Search.
+ *
+ * Applies after all other filters and ordering.
+ *
+ * Finds the closest vector embeddings to the given query vector.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ */
+ public com.google.datastore.v1.FindNearestOrBuilder getFindNearestOrBuilder() {
+ if (findNearestBuilder_ != null) {
+ return findNearestBuilder_.getMessageOrBuilder();
+ } else {
+ return findNearest_ == null
+ ? com.google.datastore.v1.FindNearest.getDefaultInstance()
+ : findNearest_;
+ }
+ }
+ /**
+ *
+ *
+ *
+ * Optional. A potential Nearest Neighbors Search.
+ *
+ * Applies after all other filters and ordering.
+ *
+ * Finds the closest vector embeddings to the given query vector.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ */
+ private com.google.protobuf.SingleFieldBuilderV3<
+ com.google.datastore.v1.FindNearest,
+ com.google.datastore.v1.FindNearest.Builder,
+ com.google.datastore.v1.FindNearestOrBuilder>
+ getFindNearestFieldBuilder() {
+ if (findNearestBuilder_ == null) {
+ findNearestBuilder_ =
+ new com.google.protobuf.SingleFieldBuilderV3<
+ com.google.datastore.v1.FindNearest,
+ com.google.datastore.v1.FindNearest.Builder,
+ com.google.datastore.v1.FindNearestOrBuilder>(
+ getFindNearest(), getParentForChildren(), isClean());
+ findNearest_ = null;
+ }
+ return findNearestBuilder_;
+ }
+
@java.lang.Override
public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryOrBuilder.java
index 70533577f..86e6d218f 100644
--- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryOrBuilder.java
+++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryOrBuilder.java
@@ -394,4 +394,57 @@ public interface QueryOrBuilder
* .google.protobuf.Int32Value limit = 12;
*/
com.google.protobuf.Int32ValueOrBuilder getLimitOrBuilder();
+
+ /**
+ *
+ *
+ *
+ * Optional. A potential Nearest Neighbors Search.
+ *
+ * Applies after all other filters and ordering.
+ *
+ * Finds the closest vector embeddings to the given query vector.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ *
+ * @return Whether the findNearest field is set.
+ */
+ boolean hasFindNearest();
+ /**
+ *
+ *
+ *
+ * Optional. A potential Nearest Neighbors Search.
+ *
+ * Applies after all other filters and ordering.
+ *
+ * Finds the closest vector embeddings to the given query vector.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ *
+ * @return The findNearest.
+ */
+ com.google.datastore.v1.FindNearest getFindNearest();
+ /**
+ *
+ *
+ *
+ * Optional. A potential Nearest Neighbors Search.
+ *
+ * Applies after all other filters and ordering.
+ *
+ * Finds the closest vector embeddings to the given query vector.
+ *
+ *
+ *
+ * .google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];
+ *
+ */
+ com.google.datastore.v1.FindNearestOrBuilder getFindNearestOrBuilder();
}
diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryProto.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryProto.java
index 60c35e2e1..489e035ab 100644
--- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryProto.java
+++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryProto.java
@@ -84,6 +84,10 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r
internal_static_google_datastore_v1_PropertyFilter_descriptor;
static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_google_datastore_v1_PropertyFilter_fieldAccessorTable;
+ static final com.google.protobuf.Descriptors.Descriptor
+ internal_static_google_datastore_v1_FindNearest_descriptor;
+ static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internal_static_google_datastore_v1_FindNearest_fieldAccessorTable;
static final com.google.protobuf.Descriptors.Descriptor
internal_static_google_datastore_v1_GqlQuery_descriptor;
static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
@@ -120,7 +124,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
+ "date_time\030\005 \001(\0132\032.google.protobuf.Timest"
+ "amp\022\016\n\006cursor\030\003 \001(\014\"Q\n\nResultType\022\033\n\027RES"
+ "ULT_TYPE_UNSPECIFIED\020\000\022\010\n\004FULL\020\001\022\016\n\nPROJ"
- + "ECTION\020\002\022\014\n\010KEY_ONLY\020\003\"\362\002\n\005Query\0223\n\nproj"
+ + "ECTION\020\002\022\014\n\010KEY_ONLY\020\003\"\257\003\n\005Query\0223\n\nproj"
+ "ection\030\002 \003(\0132\037.google.datastore.v1.Proje"
+ "ction\0221\n\004kind\030\003 \003(\0132#.google.datastore.v"
+ "1.KindExpression\022+\n\006filter\030\004 \001(\0132\033.googl"
@@ -129,77 +133,90 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
+ "inct_on\030\006 \003(\0132&.google.datastore.v1.Prop"
+ "ertyReference\022\024\n\014start_cursor\030\007 \001(\014\022\022\n\ne"
+ "nd_cursor\030\010 \001(\014\022\016\n\006offset\030\n \001(\005\022*\n\005limit"
- + "\030\014 \001(\0132\033.google.protobuf.Int32Value\"\344\004\n\020"
- + "AggregationQuery\0222\n\014nested_query\030\001 \001(\0132\032"
- + ".google.datastore.v1.QueryH\000\022L\n\014aggregat"
- + "ions\030\003 \003(\01321.google.datastore.v1.Aggrega"
- + "tionQuery.AggregationB\003\340A\001\032\277\003\n\013Aggregati"
- + "on\022H\n\005count\030\001 \001(\01327.google.datastore.v1."
- + "AggregationQuery.Aggregation.CountH\000\022D\n\003"
- + "sum\030\002 \001(\01325.google.datastore.v1.Aggregat"
- + "ionQuery.Aggregation.SumH\000\022D\n\003avg\030\003 \001(\0132"
- + "5.google.datastore.v1.AggregationQuery.A"
- + "ggregation.AvgH\000\022\022\n\005alias\030\007 \001(\tB\003\340A\001\0328\n\005"
- + "Count\022/\n\005up_to\030\001 \001(\0132\033.google.protobuf.I"
- + "nt64ValueB\003\340A\001\032?\n\003Sum\0228\n\010property\030\001 \001(\0132"
- + "&.google.datastore.v1.PropertyReference\032"
- + "?\n\003Avg\0228\n\010property\030\001 \001(\0132&.google.datast"
- + "ore.v1.PropertyReferenceB\n\n\010operatorB\014\n\n"
- + "query_type\"\036\n\016KindExpression\022\014\n\004name\030\001 \001"
- + "(\t\"!\n\021PropertyReference\022\014\n\004name\030\002 \001(\t\"F\n"
- + "\nProjection\0228\n\010property\030\001 \001(\0132&.google.d"
- + "atastore.v1.PropertyReference\"\321\001\n\rProper"
- + "tyOrder\0228\n\010property\030\001 \001(\0132&.google.datas"
- + "tore.v1.PropertyReference\022?\n\tdirection\030\002"
- + " \001(\0162,.google.datastore.v1.PropertyOrder"
- + ".Direction\"E\n\tDirection\022\031\n\025DIRECTION_UNS"
- + "PECIFIED\020\000\022\r\n\tASCENDING\020\001\022\016\n\nDESCENDING\020"
- + "\002\"\231\001\n\006Filter\022@\n\020composite_filter\030\001 \001(\0132$"
- + ".google.datastore.v1.CompositeFilterH\000\022>"
- + "\n\017property_filter\030\002 \001(\0132#.google.datasto"
- + "re.v1.PropertyFilterH\000B\r\n\013filter_type\"\261\001"
- + "\n\017CompositeFilter\0229\n\002op\030\001 \001(\0162-.google.d"
- + "atastore.v1.CompositeFilter.Operator\022,\n\007"
- + "filters\030\002 \003(\0132\033.google.datastore.v1.Filt"
- + "er\"5\n\010Operator\022\030\n\024OPERATOR_UNSPECIFIED\020\000"
- + "\022\007\n\003AND\020\001\022\006\n\002OR\020\002\"\352\002\n\016PropertyFilter\0228\n\010"
- + "property\030\001 \001(\0132&.google.datastore.v1.Pro"
- + "pertyReference\0228\n\002op\030\002 \001(\0162,.google.data"
- + "store.v1.PropertyFilter.Operator\022)\n\005valu"
- + "e\030\003 \001(\0132\032.google.datastore.v1.Value\"\270\001\n\010"
- + "Operator\022\030\n\024OPERATOR_UNSPECIFIED\020\000\022\r\n\tLE"
- + "SS_THAN\020\001\022\026\n\022LESS_THAN_OR_EQUAL\020\002\022\020\n\014GRE"
- + "ATER_THAN\020\003\022\031\n\025GREATER_THAN_OR_EQUAL\020\004\022\t"
- + "\n\005EQUAL\020\005\022\006\n\002IN\020\006\022\r\n\tNOT_EQUAL\020\t\022\020\n\014HAS_"
- + "ANCESTOR\020\013\022\n\n\006NOT_IN\020\r\"\245\002\n\010GqlQuery\022\024\n\014q"
- + "uery_string\030\001 \001(\t\022\026\n\016allow_literals\030\002 \001("
- + "\010\022H\n\016named_bindings\030\005 \003(\01320.google.datas"
- + "tore.v1.GqlQuery.NamedBindingsEntry\022C\n\023p"
- + "ositional_bindings\030\004 \003(\0132&.google.datast"
- + "ore.v1.GqlQueryParameter\032\\\n\022NamedBinding"
- + "sEntry\022\013\n\003key\030\001 \001(\t\0225\n\005value\030\002 \001(\0132&.goo"
- + "gle.datastore.v1.GqlQueryParameter:\0028\001\"d"
- + "\n\021GqlQueryParameter\022+\n\005value\030\002 \001(\0132\032.goo"
- + "gle.datastore.v1.ValueH\000\022\020\n\006cursor\030\003 \001(\014"
- + "H\000B\020\n\016parameter_type\"\215\004\n\020QueryResultBatc"
- + "h\022\027\n\017skipped_results\030\006 \001(\005\022\026\n\016skipped_cu"
- + "rsor\030\003 \001(\014\022H\n\022entity_result_type\030\001 \001(\0162,"
- + ".google.datastore.v1.EntityResult.Result"
- + "Type\0229\n\016entity_results\030\002 \003(\0132!.google.da"
- + "tastore.v1.EntityResult\022\022\n\nend_cursor\030\004 "
- + "\001(\014\022K\n\014more_results\030\005 \001(\01625.google.datas"
- + "tore.v1.QueryResultBatch.MoreResultsType"
- + "\022\030\n\020snapshot_version\030\007 \001(\003\022-\n\tread_time\030"
- + "\010 \001(\0132\032.google.protobuf.Timestamp\"\230\001\n\017Mo"
- + "reResultsType\022!\n\035MORE_RESULTS_TYPE_UNSPE"
- + "CIFIED\020\000\022\020\n\014NOT_FINISHED\020\001\022\034\n\030MORE_RESUL"
- + "TS_AFTER_LIMIT\020\002\022\035\n\031MORE_RESULTS_AFTER_C"
- + "URSOR\020\004\022\023\n\017NO_MORE_RESULTS\020\003B\273\001\n\027com.goo"
- + "gle.datastore.v1B\nQueryProtoP\001Z;cloud.go"
- + "ogle.com/go/datastore/apiv1/datastorepb;"
- + "datastorepb\252\002\031Google.Cloud.Datastore.V1\312"
- + "\002\031Google\\Cloud\\Datastore\\V1\352\002\034Google::Cl"
- + "oud::Datastore::V1b\006proto3"
+ + "\030\014 \001(\0132\033.google.protobuf.Int32Value\022;\n\014f"
+ + "ind_nearest\030\r \001(\0132 .google.datastore.v1."
+ + "FindNearestB\003\340A\001\"\344\004\n\020AggregationQuery\0222\n"
+ + "\014nested_query\030\001 \001(\0132\032.google.datastore.v"
+ + "1.QueryH\000\022L\n\014aggregations\030\003 \003(\01321.google"
+ + ".datastore.v1.AggregationQuery.Aggregati"
+ + "onB\003\340A\001\032\277\003\n\013Aggregation\022H\n\005count\030\001 \001(\01327"
+ + ".google.datastore.v1.AggregationQuery.Ag"
+ + "gregation.CountH\000\022D\n\003sum\030\002 \001(\01325.google."
+ + "datastore.v1.AggregationQuery.Aggregatio"
+ + "n.SumH\000\022D\n\003avg\030\003 \001(\01325.google.datastore."
+ + "v1.AggregationQuery.Aggregation.AvgH\000\022\022\n"
+ + "\005alias\030\007 \001(\tB\003\340A\001\0328\n\005Count\022/\n\005up_to\030\001 \001("
+ + "\0132\033.google.protobuf.Int64ValueB\003\340A\001\032?\n\003S"
+ + "um\0228\n\010property\030\001 \001(\0132&.google.datastore."
+ + "v1.PropertyReference\032?\n\003Avg\0228\n\010property\030"
+ + "\001 \001(\0132&.google.datastore.v1.PropertyRefe"
+ + "renceB\n\n\010operatorB\014\n\nquery_type\"\036\n\016KindE"
+ + "xpression\022\014\n\004name\030\001 \001(\t\"!\n\021PropertyRefer"
+ + "ence\022\014\n\004name\030\002 \001(\t\"F\n\nProjection\0228\n\010prop"
+ + "erty\030\001 \001(\0132&.google.datastore.v1.Propert"
+ + "yReference\"\321\001\n\rPropertyOrder\0228\n\010property"
+ + "\030\001 \001(\0132&.google.datastore.v1.PropertyRef"
+ + "erence\022?\n\tdirection\030\002 \001(\0162,.google.datas"
+ + "tore.v1.PropertyOrder.Direction\"E\n\tDirec"
+ + "tion\022\031\n\025DIRECTION_UNSPECIFIED\020\000\022\r\n\tASCEN"
+ + "DING\020\001\022\016\n\nDESCENDING\020\002\"\231\001\n\006Filter\022@\n\020com"
+ + "posite_filter\030\001 \001(\0132$.google.datastore.v"
+ + "1.CompositeFilterH\000\022>\n\017property_filter\030\002"
+ + " \001(\0132#.google.datastore.v1.PropertyFilte"
+ + "rH\000B\r\n\013filter_type\"\261\001\n\017CompositeFilter\0229"
+ + "\n\002op\030\001 \001(\0162-.google.datastore.v1.Composi"
+ + "teFilter.Operator\022,\n\007filters\030\002 \003(\0132\033.goo"
+ + "gle.datastore.v1.Filter\"5\n\010Operator\022\030\n\024O"
+ + "PERATOR_UNSPECIFIED\020\000\022\007\n\003AND\020\001\022\006\n\002OR\020\002\"\352"
+ + "\002\n\016PropertyFilter\0228\n\010property\030\001 \001(\0132&.go"
+ + "ogle.datastore.v1.PropertyReference\0228\n\002o"
+ + "p\030\002 \001(\0162,.google.datastore.v1.PropertyFi"
+ + "lter.Operator\022)\n\005value\030\003 \001(\0132\032.google.da"
+ + "tastore.v1.Value\"\270\001\n\010Operator\022\030\n\024OPERATO"
+ + "R_UNSPECIFIED\020\000\022\r\n\tLESS_THAN\020\001\022\026\n\022LESS_T"
+ + "HAN_OR_EQUAL\020\002\022\020\n\014GREATER_THAN\020\003\022\031\n\025GREA"
+ + "TER_THAN_OR_EQUAL\020\004\022\t\n\005EQUAL\020\005\022\006\n\002IN\020\006\022\r"
+ + "\n\tNOT_EQUAL\020\t\022\020\n\014HAS_ANCESTOR\020\013\022\n\n\006NOT_I"
+ + "N\020\r\"\323\003\n\013FindNearest\022D\n\017vector_property\030\001"
+ + " \001(\0132&.google.datastore.v1.PropertyRefer"
+ + "enceB\003\340A\002\0225\n\014query_vector\030\002 \001(\0132\032.google"
+ + ".datastore.v1.ValueB\003\340A\002\022O\n\020distance_mea"
+ + "sure\030\003 \001(\01620.google.datastore.v1.FindNea"
+ + "rest.DistanceMeasureB\003\340A\002\022/\n\005limit\030\004 \001(\013"
+ + "2\033.google.protobuf.Int32ValueB\003\340A\002\022%\n\030di"
+ + "stance_result_property\030\005 \001(\tB\003\340A\001\022=\n\022dis"
+ + "tance_threshold\030\006 \001(\0132\034.google.protobuf."
+ + "DoubleValueB\003\340A\001\"_\n\017DistanceMeasure\022 \n\034D"
+ + "ISTANCE_MEASURE_UNSPECIFIED\020\000\022\r\n\tEUCLIDE"
+ + "AN\020\001\022\n\n\006COSINE\020\002\022\017\n\013DOT_PRODUCT\020\003\"\245\002\n\010Gq"
+ + "lQuery\022\024\n\014query_string\030\001 \001(\t\022\026\n\016allow_li"
+ + "terals\030\002 \001(\010\022H\n\016named_bindings\030\005 \003(\01320.g"
+ + "oogle.datastore.v1.GqlQuery.NamedBinding"
+ + "sEntry\022C\n\023positional_bindings\030\004 \003(\0132&.go"
+ + "ogle.datastore.v1.GqlQueryParameter\032\\\n\022N"
+ + "amedBindingsEntry\022\013\n\003key\030\001 \001(\t\0225\n\005value\030"
+ + "\002 \001(\0132&.google.datastore.v1.GqlQueryPara"
+ + "meter:\0028\001\"d\n\021GqlQueryParameter\022+\n\005value\030"
+ + "\002 \001(\0132\032.google.datastore.v1.ValueH\000\022\020\n\006c"
+ + "ursor\030\003 \001(\014H\000B\020\n\016parameter_type\"\215\004\n\020Quer"
+ + "yResultBatch\022\027\n\017skipped_results\030\006 \001(\005\022\026\n"
+ + "\016skipped_cursor\030\003 \001(\014\022H\n\022entity_result_t"
+ + "ype\030\001 \001(\0162,.google.datastore.v1.EntityRe"
+ + "sult.ResultType\0229\n\016entity_results\030\002 \003(\0132"
+ + "!.google.datastore.v1.EntityResult\022\022\n\nen"
+ + "d_cursor\030\004 \001(\014\022K\n\014more_results\030\005 \001(\01625.g"
+ + "oogle.datastore.v1.QueryResultBatch.More"
+ + "ResultsType\022\030\n\020snapshot_version\030\007 \001(\003\022-\n"
+ + "\tread_time\030\010 \001(\0132\032.google.protobuf.Times"
+ + "tamp\"\230\001\n\017MoreResultsType\022!\n\035MORE_RESULTS"
+ + "_TYPE_UNSPECIFIED\020\000\022\020\n\014NOT_FINISHED\020\001\022\034\n"
+ + "\030MORE_RESULTS_AFTER_LIMIT\020\002\022\035\n\031MORE_RESU"
+ + "LTS_AFTER_CURSOR\020\004\022\023\n\017NO_MORE_RESULTS\020\003B"
+ + "\273\001\n\027com.google.datastore.v1B\nQueryProtoP"
+ + "\001Z;cloud.google.com/go/datastore/apiv1/d"
+ + "atastorepb;datastorepb\252\002\031Google.Cloud.Da"
+ + "tastore.V1\312\002\031Google\\Cloud\\Datastore\\V1\352\002"
+ + "\034Google::Cloud::Datastore::V1b\006proto3"
};
descriptor =
com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(
@@ -232,6 +249,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
"EndCursor",
"Offset",
"Limit",
+ "FindNearest",
});
internal_static_google_datastore_v1_AggregationQuery_descriptor =
getDescriptor().getMessageTypes().get(2);
@@ -335,8 +353,21 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
new java.lang.String[] {
"Property", "Op", "Value",
});
- internal_static_google_datastore_v1_GqlQuery_descriptor =
+ internal_static_google_datastore_v1_FindNearest_descriptor =
getDescriptor().getMessageTypes().get(10);
+ internal_static_google_datastore_v1_FindNearest_fieldAccessorTable =
+ new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
+ internal_static_google_datastore_v1_FindNearest_descriptor,
+ new java.lang.String[] {
+ "VectorProperty",
+ "QueryVector",
+ "DistanceMeasure",
+ "Limit",
+ "DistanceResultProperty",
+ "DistanceThreshold",
+ });
+ internal_static_google_datastore_v1_GqlQuery_descriptor =
+ getDescriptor().getMessageTypes().get(11);
internal_static_google_datastore_v1_GqlQuery_fieldAccessorTable =
new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_google_datastore_v1_GqlQuery_descriptor,
@@ -352,7 +383,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
"Key", "Value",
});
internal_static_google_datastore_v1_GqlQueryParameter_descriptor =
- getDescriptor().getMessageTypes().get(11);
+ getDescriptor().getMessageTypes().get(12);
internal_static_google_datastore_v1_GqlQueryParameter_fieldAccessorTable =
new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_google_datastore_v1_GqlQueryParameter_descriptor,
@@ -360,7 +391,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
"Value", "Cursor", "ParameterType",
});
internal_static_google_datastore_v1_QueryResultBatch_descriptor =
- getDescriptor().getMessageTypes().get(12);
+ getDescriptor().getMessageTypes().get(13);
internal_static_google_datastore_v1_QueryResultBatch_fieldAccessorTable =
new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_google_datastore_v1_QueryResultBatch_descriptor,
diff --git a/proto-google-cloud-datastore-v1/src/main/proto/google/datastore/v1/query.proto b/proto-google-cloud-datastore-v1/src/main/proto/google/datastore/v1/query.proto
index 5ec0eea61..3c2e8ae66 100644
--- a/proto-google-cloud-datastore-v1/src/main/proto/google/datastore/v1/query.proto
+++ b/proto-google-cloud-datastore-v1/src/main/proto/google/datastore/v1/query.proto
@@ -82,6 +82,15 @@ message EntityResult {
}
// A query for entities.
+//
+// The query stages are executed in the following order:
+// 1. kind
+// 2. filter
+// 3. projection
+// 4. order + start_cursor + end_cursor
+// 5. offset
+// 6. limit
+// 7. find_nearest
message Query {
// The projection to return. Defaults to returning all properties.
repeated Projection projection = 2;
@@ -127,6 +136,13 @@ message Query {
// Unspecified is interpreted as no limit.
// Must be >= 0 if specified.
google.protobuf.Int32Value limit = 12;
+
+ // Optional. A potential Nearest Neighbors Search.
+ //
+ // Applies after all other filters and ordering.
+ //
+ // Finds the closest vector embeddings to the given query vector.
+ FindNearest find_nearest = 13 [(google.api.field_behavior) = OPTIONAL];
}
// Datastore query for running an aggregation over a
@@ -436,6 +452,70 @@ message PropertyFilter {
Value value = 3;
}
+// Nearest Neighbors search config. The ordering provided by FindNearest
+// supersedes the order_by stage. If multiple documents have the same vector
+// distance, the returned document order is not guaranteed to be stable between
+// queries.
+message FindNearest {
+ // The distance measure to use when comparing vectors.
+ enum DistanceMeasure {
+ // Should not be set.
+ DISTANCE_MEASURE_UNSPECIFIED = 0;
+
+ // Measures the EUCLIDEAN distance between the vectors. See
+ // [Euclidean](https://en.wikipedia.org/wiki/Euclidean_distance) to learn
+ // more. The resulting distance decreases the more similar two vectors are.
+ EUCLIDEAN = 1;
+
+ // COSINE distance compares vectors based on the angle between them, which
+ // allows you to measure similarity that isn't based on the vectors
+ // magnitude. We recommend using DOT_PRODUCT with unit normalized vectors
+ // instead of COSINE distance, which is mathematically equivalent with
+ // better performance. See [Cosine
+ // Similarity](https://en.wikipedia.org/wiki/Cosine_similarity) to learn
+ // more about COSINE similarity and COSINE distance. The resulting COSINE
+ // distance decreases the more similar two vectors are.
+ COSINE = 2;
+
+ // Similar to cosine but is affected by the magnitude of the vectors. See
+ // [Dot Product](https://en.wikipedia.org/wiki/Dot_product) to learn more.
+ // The resulting distance increases the more similar two vectors are.
+ DOT_PRODUCT = 3;
+ }
+
+ // Required. An indexed vector property to search upon. Only documents which
+ // contain vectors whose dimensionality match the query_vector can be
+ // returned.
+ PropertyReference vector_property = 1
+ [(google.api.field_behavior) = REQUIRED];
+
+ // Required. The query vector that we are searching on. Must be a vector of no
+ // more than 2048 dimensions.
+ Value query_vector = 2 [(google.api.field_behavior) = REQUIRED];
+
+ // Required. The Distance Measure to use, required.
+ DistanceMeasure distance_measure = 3 [(google.api.field_behavior) = REQUIRED];
+
+ // Required. The number of nearest neighbors to return. Must be a positive
+ // integer of no more than 100.
+ google.protobuf.Int32Value limit = 4 [(google.api.field_behavior) = REQUIRED];
+
+ // Optional. Optional name of the field to output the result of the vector
+ // distance calculation. Must conform to [entity
+ // property][google.datastore.v1.Entity.properties] limitations.
+ string distance_result_property = 5 [(google.api.field_behavior) = OPTIONAL];
+
+ // Optional. Option to specify a threshold for which no less similar documents
+ // will be returned. The behavior of the specified `distance_measure` will
+ // affect the meaning of the distance threshold. Since DOT_PRODUCT distances
+ // increase when the vectors are more similar, the comparison is inverted.
+ //
+ // For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold
+ // For DOT_PRODUCT: WHERE distance >= distance_threshold
+ google.protobuf.DoubleValue distance_threshold = 6
+ [(google.api.field_behavior) = OPTIONAL];
+}
+
// A [GQL
// query](https://cloud.google.com/datastore/docs/apis/gql/gql_reference).
message GqlQuery {
diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml
index 4da3f232b..3c12a1725 100644
--- a/samples/snapshot/pom.xml
+++ b/samples/snapshot/pom.xml
@@ -28,7 +28,7 @@
com.google.cloud
google-cloud-datastore
- 2.23.0
+ 2.24.0
diff --git a/samples/snippets/src/test/java/com/google/datastore/snippets/ConceptsTest.java b/samples/snippets/src/test/java/com/google/datastore/snippets/ConceptsTest.java
index 1397728ba..045b16a9a 100644
--- a/samples/snippets/src/test/java/com/google/datastore/snippets/ConceptsTest.java
+++ b/samples/snippets/src/test/java/com/google/datastore/snippets/ConceptsTest.java
@@ -297,8 +297,17 @@ public void testLookup() {
public void testUpdate() {
datastore.put(testEntity);
// [START datastore_update]
- Entity task = Entity.newBuilder(datastore.get(taskKey)).set("priority", 5).build();
- datastore.update(task);
+ Entity task;
+ Transaction txn = datastore.newTransaction();
+ try {
+ task = Entity.newBuilder(txn.get(taskKey)).set("priority", 5).build();
+ txn.put(task);
+ txn.commit();
+ } finally {
+ if (txn.isActive()) {
+ txn.rollback();
+ }
+ }
// [END datastore_update]
assertEquals(task, datastore.get(taskKey));
}
diff --git a/versions.txt b/versions.txt
index 666cbda4e..cbf5e4466 100644
--- a/versions.txt
+++ b/versions.txt
@@ -1,9 +1,9 @@
# Format:
# module:released-version:current-version
-google-cloud-datastore:2.23.0:2.23.0
-google-cloud-datastore-bom:2.23.0:2.23.0
-proto-google-cloud-datastore-v1:0.114.0:0.114.0
-datastore-v1-proto-client:2.23.0:2.23.0
-proto-google-cloud-datastore-admin-v1:2.23.0:2.23.0
-grpc-google-cloud-datastore-admin-v1:2.23.0:2.23.0
+google-cloud-datastore:2.24.0:2.24.0
+google-cloud-datastore-bom:2.24.0:2.24.0
+proto-google-cloud-datastore-v1:0.115.0:0.115.0
+datastore-v1-proto-client:2.24.0:2.24.0
+proto-google-cloud-datastore-admin-v1:2.24.0:2.24.0
+grpc-google-cloud-datastore-admin-v1:2.24.0:2.24.0