Skip to content

Commit

Permalink
another example
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkDuckworth committed Aug 8, 2024
1 parent 07a6409 commit d9eea7a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Firestore/Swift/Tests/Integration/VectorIntegrationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit d9eea7a

Please sign in to comment.