Filter types
VectorAI DB supports three filter types that combine to create complex queries:Must filters
All conditions in a must filter must be true for a result to be returned. This makes must filters the right choice for non-negotiable requirements such as user permissions, availability status, or regulatory constraints.Should filters
At least one condition in a should filter must be true for a result to match. Use should filters to broaden search scope across multiple related categories or to accommodate varied user preferences.Must-not filters
Any result matching a must-not condition is excluded. Use must-not filters to remove inappropriate content, out-of-stock items, or categories a user wants to avoid.Combine filter types
Combine all three filter types to create complex queries. For example, require a specific category (must), prefer items that are cheap or highly rated (should), and exclude refurbished items (must-not). Complex filters give precise control over results while maintaining semantic similarity.Filter operators
VectorAI DB supports multiple comparison operators for different data types and matching requirements.Equality operators
eq(): Equal to specified value.ne(): Not equal to specified value.
Comparison operators
lt(): Less than specified value.lte(): Less than or equal to specified value.gt(): Greater than specified value.gte(): Greater than or equal to specified value.
Array operators
contains(): Array contains specified value.contains_any(): Array contains any of the specified values.contains_all(): Array contains all of the specified values.
When to use filtering
Use filtering when you need to:- Restrict search to specific categories, price ranges, or date ranges.
- Enforce availability constraints, user permissions, or compliance requirements.
- Match both semantic meaning and metadata conditions simultaneously.
- Remove inappropriate content, out-of-stock items, or avoided categories.
Task guides
The following guides cover common filter patterns step by step.- Filter with must conditions.
- Filter with should conditions.
- Filter with must-not conditions.
- Combine filter types.
Next steps
- Search operations — Apply filters in vector queries.
- Payload structure — Design metadata for filtering.
- Points — Manage the data that filters operate on.
- Distance metrics — Choose the right similarity measure.