Skip to main content
Semantic search finds documents by meaning rather than exact keyword matching. Actian VectorAI DB compares vector embeddings to retrieve content that is conceptually similar to your query, even when the words differ. Semantic search encodes both your query and stored documents as vector embeddings. VectorAI DB compares these embeddings using a distance metric to rank results by semantic similarity. This approach captures meaning and context, making it effective for natural language queries across diverse content. Common use cases include:
  • 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:
  1. Embed documents — Convert each document into a vector embedding using an embedding model and store it in a collection with associated metadata as payload.
  2. Create field indexes — Index payload fields you plan to filter on for efficient evaluation.
  3. Embed query — Convert your search query into a vector using the same embedding model.
  4. Search — VectorAI DB compares the query vector against stored vectors and returns the most similar results, optionally filtered by metadata conditions.
The embedding model you choose determines the quality of semantic matching. Use the same model for both indexing and querying to ensure consistent vector representations.

Search strategies

VectorAI DB supports several semantic search strategies that combine vector similarity with metadata constraints: 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. Use score_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:

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.