- Retrieval-Augmented Generation (RAG) pipelines
- Natural language document search
- Knowledge base retrieval
- Question answering systems
- Content recommendation
How semantic search works
Semantic search follows a standard pipeline:- Embed documents — Convert each document into a vector embedding using an embedding model and store it in a collection with associated metadata as payload.
- Create field indexes — Index payload fields you plan to filter on for efficient evaluation.
- Embed query — Convert your search query into a vector using the same embedding model.
- Search — VectorAI DB compares the query vector against stored vectors and returns the most similar results, optionally filtered by metadata conditions.
Search strategies
VectorAI DB supports several semantic search strategies that combine vector similarity with metadata constraints:Setting up for semantic search
Semantic search requires a collection with vector configuration and field indexes on any payload fields used for filtering.Collection configuration
Create a collection with a vector size matching your embedding model and a distance metric suited to your use case. Cosine similarity is the most common choice for text embeddings because it measures directional similarity independent of vector magnitude.Field indexes
Create field indexes on payload fields before performing filtered searches. Indexes enable VectorAI DB to evaluate filter conditions efficiently during search. Without indexes, filtered searches fall back to scanning all points. The following table lists the supported field types for indexing. The index type values shown are the Python SDK constants.Score interpretation
When using cosine similarity, scores range from negative one to one. Higher scores indicate greater semantic similarity between the query and result vectors. A score of one means the vectors point in the same direction, while a score of zero means they are orthogonal. Usescore_threshold to control result quality. Setting a threshold filters out results below a minimum similarity score, ensuring only relevant matches are returned. The optimal threshold depends on your embedding model and data characteristics — experiment with different values to find the right balance between precision and recall.
Performance considerations
Several strategies optimize semantic search performance:- Index filtered fields — Create field indexes on all payload fields used in filters to avoid full scans.
- Pre-filter over post-filter — Applying filters during search is more efficient than filtering results after retrieval.
- Limit result count — Request only the number of results you need to reduce computation and network overhead.
- Use score thresholds — Discard low-quality results early to reduce downstream processing.
- Batch operations — Upsert documents in batches when indexing large corpora to improve throughput.
Task guides
See step-by-step guides for semantic search operations:- Pure semantic search
- Filtered semantic search
- Score threshold search
- Multiconstraint search
- Complete workflow
Next steps
Explore related topics to deepen your understanding of search in VectorAI DB:- For vector search parameters and result fields, see Search.
- For filter syntax including must, should, and must-not conditions, see Filtering.
- For combining multiple search strategies with fusion algorithms, see Hybrid search.
- For managing metadata attached to your documents, see Payload.
- For understanding how similarity scores are calculated, see Distance metrics.