Definition

Vector search retrieves items by comparing a query vector with stored vectors. It orders results using a similarity or distance function, such as cosine similarity, dot product, or Euclidean distance.

The vectors often come from an embedding model, but vector search is the comparison and retrieval operation, not the model that created them. When using embeddings, choose a function compatible with how the model was trained or documented, including any normalization assumptions.

Simple example

An application embeds the question “How do I stop a worker cleanly?” and compares that vector with embeddings of documentation passages. A passage about cancellation in a .NET BackgroundService may rank highly even if it never uses the question’s exact words.

Why it matters

Lexical search works well when the query and document share names or terms. Vector search can also retrieve passages that use different wording. That makes it a useful candidate-generation step in RAG, recommendation, and similarity systems.

At scale, an approximate nearest-neighbor index can reduce query latency or computation. It may miss some neighbors that an exact search would return, and the index may use additional memory or storage.

One important nuance

Nearest in vector space does not automatically mean relevant to the user’s task. A passage about a different product version can still be close to the query vector. Filters, hybrid keyword search, score thresholds, and reranking can help narrow or reorder the candidates.