Semantic search
Search that matches by meaning instead of exact words, by comparing embeddings of the query and the documents.

Semantic search matches by meaning instead of exact words, by comparing embeddings of the query and the documents. “How do I cancel” finds a page titled “Ending your subscription” even though they share no words.
The query and the documents are turned into embeddings, and the nearest vectors in a vector database are returned. It works across phrasing and often across languages, so a Polish question can find an English document if the embedding model is multilingual. It is weak on exact strings such as codes and names. It also always returns something, even when nothing relevant exists, because some vector is always nearest. A similarity threshold or an explicit “no result” path is what lets the system admit it found nothing.
Keyword search such as BM25 has the opposite strengths, and most production systems run both as hybrid search. Semantic search alone suits conversational queries over prose, such as help-center articles. In RAG it is the default retrieval step, and its misses become wrong answers, so measure it with context recall on real queries before blaming the model.
Related terms
- Embeddings: Vectors of numbers that place texts with similar meaning close together.
- Vector database (pgvector and others): A database that stores embeddings and finds the nearest ones to a query vector quickly, which is the search step behind most RAG systems.
- Hybrid search: Combining keyword search (such as BM25) with vector search, so results match both exact terms and meaning.
- BM25: The standard keyword-search ranking formula: it scores documents by how often query words appear, weighting rare words more.
- RAG (retrieval-augmented generation): Finding relevant documents first and putting them into the prompt, so the model answers from them.
- Context recall: A RAG retrieval metric: how much of the information needed for the correct answer was actually retrieved.
