- Price ranges
- Availability status
- Category restrictions
id: The unique identifier of the matching point.score: Similarity score for points that passed the filter.payload: Metadata dictionary showing filtered attributes.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Combine vector similarity with metadata conditions.
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())
import { VectorAIClient, Field } from '@actian/vectorai-client';
async function main() {
const client = new VectorAIClient('localhost:6574');
try {
// Generate query vector
const queryVector = Array.from({ length: 128 }, () => Math.random() * 2 - 1);
// Search with metadata filters
const filter = new Field('category').eq('electronics')
.and(new Field('price').lt(500.0));
// Search with filter
const results = await client.points.search(
'my_collection', // Collection name
queryVector, // Query vector
{
limit: 10, // Number of results
filter: filter // Apply filter
}
);
// Display results
for (const result of results) {
console.log(`Product: ${result.payload.name}`);
console.log(`Price: $${result.payload.price}`);
console.log(`Score: ${result.score}`);
}
} finally {
client.close();
}
}
main().catch(console.error);
id: The unique identifier of the matching point.score: Similarity score for points that passed the filter.payload: Metadata dictionary showing filtered attributes.