diff --git a/Firestore/Swift/Tests/Integration/VectorIntegrationTests.swift b/Firestore/Swift/Tests/Integration/VectorIntegrationTests.swift index 0db7bce41c0..22740e8058d 100644 --- a/Firestore/Swift/Tests/Integration/VectorIntegrationTests.swift +++ b/Firestore/Swift/Tests/Integration/VectorIntegrationTests.swift @@ -34,6 +34,21 @@ class VectorIntegrationTests: FSTIntegrationTestCase { try await vectorQuery.getDocuments(source: VectorSource.server) } + func exampleFindNearestWithOptions() async throws { + let collection = collectionRef() + + let vectorQuery = collection.findNearest( + fieldPath: "embedding", + queryVector: [1.0, 2.0, 3.0], + limit: 10, + distanceMeasure: FirestoreDistanceMeasure.cosine, + options: FindNearestOptions().withDistanceResultFieldPath("distance") + .withDistanceThreshold(0.5) + ) + + try await vectorQuery.getDocuments(source: VectorSource.server) + } + func testWriteAndReadVectorEmbeddings() async throws { let collection = collectionRef()