Skip to content

Commit f267339

Browse files
committed
Adjust testVectorSearch sample code
1 parent 9694abb commit f267339

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

com/google/datastore/snippets/ConceptsTest.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -731,20 +731,6 @@ public void testInequalitySortInvalidNotFirst() {
731731
assertInvalidQuery(query);
732732
}
733733

734-
@Test
735-
public void testVectorSearch() {
736-
setUpQueryTests();
737-
// [START datastore_vector_search]
738-
VectorValue vectorValue = VectorValue.newBuilder(1.78, 2.56, 3.88).build();
739-
FindNearest vectorQuery =
740-
new FindNearest(
741-
"vector_property", vectorValue, FindNearest.DistanceMeasure.COSINE, 1, "distance");
742-
743-
Query<Entity> query = Query.newEntityQueryBuilder().setFindNearest(vectorQuery).build();
744-
// [END datastore_vector_search]
745-
assertValidQuery(query);
746-
}
747-
748734
@Test
749735
public void testLimit() {
750736
setUpQueryTests();
@@ -1212,4 +1198,18 @@ public void testStaleReads() throws InterruptedException {
12121198
// [END datastore_stale_read]
12131199
assertValidQueryRealBackend(query);
12141200
}
1201+
1202+
@Test
1203+
public void testVectorSearch() {
1204+
setUpQueryTests();
1205+
// [START datastore_vector_search]
1206+
VectorValue vectorValue = VectorValue.newBuilder(1.78, 2.56, 3.88).build();
1207+
FindNearest vectorQuery =
1208+
new FindNearest(
1209+
"vector_property", vectorValue, FindNearest.DistanceMeasure.COSINE, 1, "distance");
1210+
1211+
Query<Entity> query = Query.newEntityQueryBuilder().setFindNearest(vectorQuery).build();
1212+
// [END datastore_vector_search]
1213+
assertValidQuery(query);
1214+
}
12151215
}

0 commit comments

Comments
 (0)