Skip to content

Commit 32fdd41

Browse files
committed
Fix empty FindNearest pb instance
1 parent 6df2d8a commit 32fdd41

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

google-cloud-datastore/src/main/java/com/google/cloud/datastore/FindNearest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ public enum DistanceMeasure {
191191
* unit normalized vectors instead of COSINE distance, which is mathematically equivalent with
192192
* better performance.
193193
*/
194+
DISTANCE_MEASURE_UNSPECIFIED,
194195
COSINE,
195196
/** Measures the EUCLIDEAN distance between the vectors. */
196197
EUCLIDEAN,

google-cloud-datastore/src/main/java/com/google/cloud/datastore/StructuredQuery.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,7 @@ B mergeFrom(com.google.datastore.v1.Query queryPb) {
917917
for (com.google.datastore.v1.PropertyReference distinctOnPb : queryPb.getDistinctOnList()) {
918918
addDistinctOn(distinctOnPb.getName());
919919
}
920-
if (queryPb.getFindNearest() != null) {
920+
if (queryPb.getFindNearest() != null && queryPb.getFindNearest() != com.google.datastore.v1.FindNearest.getDefaultInstance()) {
921921
setFindNearest(FindNearest.fromPb(queryPb.getFindNearest()));
922922
}
923923
return self();

0 commit comments

Comments
 (0)