Vector search (semantic search)
Quick definition
Vector search is a retrieval method that returns the items whose embeddings are closest to the query's embedding, so results match by meaning rather than by shared keywords. It is the usual engine of semantic search.
On this page
How vector search works
Every document, passage or product is turned into an embedding and stored in an index. At query time the question is embedded with the same model, and the index returns the nearest vectors, usually measured by cosine similarity. A customer asking “something warm for skiing” can find a jacket described as “insulated, waterproof winter shell” even though no word matches.
Comparing a query with millions of vectors one by one would be slow, so indexes use approximate nearest-neighbour algorithms. HNSW, a layered graph described by Malkov and Yashunin in 2016, is one of the most widely used; it trades a tiny loss of accuracy for very fast search. Open-source extensions such as pgvector bring these indexes to PostgreSQL.
Semantic search vs keyword search
Keyword search (BM25, full-text, trigram matching) is precise on exact terms: a product reference, a brand, an error code. It fails on synonyms and paraphrases. Vector search is the reverse: strong on meaning, weak on exact strings and rare identifiers.
That is why most production systems use hybrid search: run both, then merge or re-rank the results. Dense retrieval research such as Karpukhin and colleagues' 2020 work on question answering showed how much semantic retrieval improves recall, and practitioners have since learned how much it still benefits from a keyword partner.
Pitfalls
Vector search always returns something, even when nothing relevant exists, so a system needs a relevance threshold or a check before using the results. It does not understand numbers or constraints: “under 50 euros, in stock, size M” needs real filters on structured data. And quality depends on how content was split: passages that are too long blur the meaning, passages that are too short lose context.
Vector search in AI SmartTalk
AI SmartTalk stores embeddings in PostgreSQL with pgvector, with an HNSW index on product documents, and combines vector similarity with trigram and full-text search. For products, the assistant's search tool adds structured filters on price, stock, brand, category and variant attributes, so that a semantic question and a precise constraint can be answered together.
Frequently asked questions
Is semantic search the same as vector search?
Semantic search is the goal — finding results by meaning. Vector search over embeddings is the most common way to achieve it, often combined with keyword search.
Do I need a dedicated vector database?
Not necessarily. Extensions such as pgvector add vector indexes to PostgreSQL, which is enough for many applications and keeps vectors next to the rest of the data.
What is hybrid search?
A search that runs vector search and keyword search together and merges the results, so that it handles both paraphrased questions and exact terms such as product references.