AppSearchVectorStore

public final class AppSearchVectorStore implements VectorStore


A vector store implementation using Android system-level AppSearch storage.

Summary

Public constructors

AppSearchVectorStore(Context context, String databaseName)

Public methods

void
void

Deletes the records matching the specified IDs.

void
delete(Map<String, String> metadataFilter)

Deletes the records matching the specified metadata filter.

void

Deletes all records from the vector store.

List<RetrievalRecord>
get(List<String> ids)

Retrieves the records matching the specified IDs (Key-Value lookup).

List<String>

Retrieves all unique record identifiers in the vector store.

List<RetrievalRecord>
search(float[] queryEmbedding, int topK)

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

List<RetrievalRecord>
search(
    float[] queryEmbedding,
    int topK,
    Map<String, String> metadataFilter
)

Searches the top-K nearest records matching the query embedding and metadata filter.

void

Upserts a list of records in the vector store.

Public constructors

AppSearchVectorStore

public AppSearchVectorStore(Context context, String databaseName)

Public methods

close

public void close()

delete

public void delete(List<String> ids)

Deletes the records matching the specified IDs.

delete

public void delete(Map<String, String> metadataFilter)

Deletes the records matching the specified metadata filter.

deleteAll

public void deleteAll()

Deletes all records from the vector store.

get

public List<RetrievalRecord> get(List<String> ids)

Retrieves the records matching the specified IDs (Key-Value lookup).

getAllRecordIds

public List<String> getAllRecordIds()

Retrieves all unique record identifiers in the vector store.

search

public List<RetrievalRecord> search(float[] queryEmbedding, int topK)

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

search

public List<RetrievalRecord> search(
    float[] queryEmbedding,
    int topK,
    Map<String, String> metadataFilter
)

Searches the top-K nearest records matching the query embedding and metadata filter.

upsert

public void upsert(List<RetrievalRecord> records)

Upserts a list of records in the vector store.