Documentation Index
Fetch the complete documentation index at: https://docs.vectoraidb.actian.com/llms.txt
Use this file to discover all available pages before exploring further.
Filtered search combines vector similarity with metadata conditions. Results must match both your query similarity and filter criteria.
The filter conditions evaluate alongside vector similarity, not instead of it. VectorAI DB finds similar vectors that also meet your criteria. Use filtered search to combine semantic search with business rules like:
- Price ranges
- Availability status
- Category restrictions
import asyncio
from actian_vectorai import AsyncVectorAIClient, FilterBuilder, Field
import random
async def main():
# Connect to VectorAI DB server
async with AsyncVectorAIClient("localhost:6574") as client:
# Generate query vector
query_vector = [random.gauss(0, 1) for _ in range(128)]
# Search with metadata filters
filter = FilterBuilder()\
.must(Field("category").eq("electronics"))\
.must(Field("price").lt(500.0))\
.build()
# Search with filter
results = await client.points.search(
"my_collection", # Collection name
vector=query_vector, # Query vector
limit=10, # Number of results
filter=filter # Apply filter
)
# Display results
for result in results:
print(f"Product: {result.payload['name']}")
print(f"Price: ${result.payload['price']}")
print(f"Score: {result.score}")
asyncio.run(main())
Learn more about filter syntax and operators in the filtering documentation.
Each result includes these fields:
id: The unique identifier of the matching point.
score: Similarity score for points that passed the filter.
payload: Metadata dictionary showing filtered attributes.