Asynchronously search for items within a namespace prefix.
Basic filtering:
# Search for documents with specific metadata
results = await store.asearch(
("docs",),
filter={"type": "article", "status": "published"}
)
Natural language search (requires vector store implementation):
# Initialize store with embedding configuration
store = YourStore( # e.g., InMemoryStore, AsyncPostgresStore
index={
"dims": 1536, # embedding dimensions
"embed": your_embedding_function, # function to create embeddings
"fields": ["text"] # fields to embed
}
)
# Search for semantically similar documents
results = await store.asearch(
("docs",),
query="machine learning applications in healthcare",
filter={"type": "research_paper"},
limit=5
)
Natural language search support depends on your store implementation and requires proper embedding configuration.
Key-value pairs to filter results.
Maximum number of items to return.
Number of items to skip before returning results.
Whether to refresh TTLs for the returned items.
If None, uses the store's TTLConfig.refresh_default setting.
If TTLConfig is not provided or no TTL is specified, this argument is ignored.