Semantic Search
Semantic search matches meaning rather than exact words, using embeddings to retrieve results that share intent even when they use different vocabulary.
Definition
Semantic search is a retrieval approach that represents queries and documents as vectors and ranks documents by embedding similarity, capturing meaning instead of surface lexical overlap.
Context and scope
It is used where users describe what they want in their own words and keyword matching misses valid results.
Common misconceptions
- semantic search always beats keyword search
- embeddings make exact identifiers and codes searchable
Anti-patterns
- dropping lexical search entirely and losing exact-match ability
- using a general embedding model without domain evaluation
Related concepts
Related examples
Authoritative source
Definition
Semantic search is a retrieval approach that represents queries and documents as vectors and ranks documents by embedding similarity, capturing meaning instead of surface lexical overlap.
It is used where users describe what they want in their own words and keyword matching misses valid results. Compared to simpler alternatives, this concept fits best when the trade-off it represents is the one the system actually cares about.
When to use it
A common use case is applying it at the boundary where the cost of getting it wrong is highest, and the scenario usually involves a concrete guarantee the system must uphold. Unlike an ad hoc approach, it makes that guarantee explicit, reviewable, and testable.
How it works
Because similarity is learned, synonymous phrasing retrieves the right document, but rare terms, codes, and names may embed poorly and need lexical support.
Hybrid approaches combine embedding similarity with keyword scoring and fusion, capturing both semantic intent and exact tokens.
Trade-offs and alternatives
Evaluation must use real queries with graded relevance, because approximate metrics can look good while users still fail to find results. The main drawback is the extra complexity it introduces, so the benefit should clearly outweigh that cost before a team adopts it.
Common misconceptions
A persistent misconception is that semantic search always beats keyword search. Another is that embeddings make exact identifiers and codes searchable. For example, an engineer who assumes otherwise may design around a guarantee that does not actually exist, which only becomes obvious under load or failure.
Anti-patterns to avoid
Two recurring anti-patterns are to dropping lexical search entirely and losing exact-match ability and to using a general embedding model without domain evaluation. Both tend to surface as hard-to-debug production issues rather than obvious test failures. Related concepts include Text Embeddings, Tokenization and Subword Units, The Context Window.