Semantic search
Search that matches by meaning instead of exact words, by comparing embeddings of the query and the documents.
The query and the documents are turned into embeddings, and the nearest vectors in a vector database are returned. “How do I cancel” finds a page titled “Ending your subscription” with no shared words. It works across phrasing and often across languages, but it is weak on exact strings such as codes and names, and it always returns something, even when nothing relevant exists.
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.
