# VectorStore

    protocol VectorStore: NSObjectProtocol

A protocol that defines the storage backend for semantic retriever.
- `
  ### [delete(withIds:)](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Protocols/VectorStore.md.txt#/c:objc(pl)MPPVectorStore(im)deleteWithIds:error:)

  ` Deletes the records matching the specified IDs.

  #### Declaration

  Swift

      func delete(withIds ids: [String]) throws

- `
  ### [delete(withMetadataFilter:)](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Protocols/VectorStore.md.txt#/c:objc(pl)MPPVectorStore(im)deleteWithMetadataFilter:error:)

  ` Deletes records matching the specified metadata filter.

  #### Declaration

  Swift

      func delete(withMetadataFilter metadataFilter: [String: String]) throws

- `
  ### [deleteAllRecords()](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Protocols/VectorStore.md.txt#/c:objc(pl)MPPVectorStore(im)deleteAllRecords:)

  ` Deletes all records from the vector store.

  #### Declaration

  Swift

      func deleteAllRecords() throws

- `
  ### [getRecord(withId:)](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Protocols/VectorStore.md.txt#/c:objc(pl)MPPVectorStore(im)getRecordWithId:error:)

  ` Retrieves a single record matching the specified ID.

  #### Declaration

  Swift

      func getRecord(withId recordId: String) throws -> RetrievalRecord

- `
  ### [getRecordsWithIds(_:)](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Protocols/VectorStore.md.txt#/c:objc(pl)MPPVectorStore(im)getRecordsWithIds:error:)

  ` Retrieves the records matching the specified IDs.

  #### Declaration

  Swift

      func getRecordsWithIds(_ ids: [String]) throws -> [RetrievalRecord]

- `
  ### [recordIdentifiers()](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Protocols/VectorStore.md.txt#/c:objc(pl)MPPVectorStore(im)recordIdentifiers:)

  ` Retrieves all unique top-level record identifiers in the vector store.

  #### Declaration

  Swift

      func recordIdentifiers() throws -> [String]

- `
  ### [search(withEmbedding:topK:)](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Protocols/VectorStore.md.txt#/c:objc(pl)MPPVectorStore(im)searchWithEmbedding:topK:error:)

  ` Searches the top-K nearest records to the query embedding.

  #### Declaration

  Swift

      func search(withEmbedding queryEmbedding: [NSNumber], topK: Int) throws -> [RetrievalRecord]

- `
  ### [search(withEmbedding:topK:metadataFilter:)](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Protocols/VectorStore.md.txt#/c:objc(pl)MPPVectorStore(im)searchWithEmbedding:topK:metadataFilter:error:)

  ` Searches the top-K nearest records to the query embedding with optional metadata filtering.

  #### Declaration

  Swift

      func search(withEmbedding queryEmbedding: [NSNumber], topK: Int, metadataFilter: [String: String]?) throws -> [RetrievalRecord]

- `
  ### [upsertRecords(_:)](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Protocols/VectorStore.md.txt#/c:objc(pl)MPPVectorStore(im)upsertRecords:error:)

  ` Upserts a list of records in the vector store.

  #### Declaration

  Swift

      func upsertRecords(_ records: [RetrievalRecord]) throws