What is semantic search?

Semantic search is a search method that matches a query to results by meaning rather than exact words, usually by comparing embeddings, so "money back for a cancelled order" can find a page titled "Refund policy".

Also called meaning-based search, neural searchUpdated

Keyword search, usually ranked with an algorithm called BM25, scores documents by the words they share with the query. It is fast, predictable and excellent for exact terms. It fails when the user and the document use different words: a shopper typing "something warm for a winter wedding" won't match a product described as a "wool-blend festive shawl".

Semantic search compares meaning instead. Queries and documents are turned into embeddings, and the search returns the documents whose vectors sit closest to the query's vector.

How it works

  1. Index. Split content into passages or product records, embed each one, and store the vectors with metadata in a vector database or a search engine with vector support.
  2. Query. Embed the user's query with the same model.
  3. Retrieve. Find the nearest vectors with an approximate nearest-neighbour index, applying filters such as category, price band, language or access rights.
  4. Re-rank (optional). A reranking model reads the query and each top candidate together and puts them in a more precise order.

In retrieval-augmented generation, the top passages from this process become the language model's context.

  • Keyword search matches words. It is best for product codes, names, legal section numbers and anything users expect to match exactly.
  • Vector search is the mechanism: finding nearest neighbours among vectors. It also powers image search and recommendations.
  • Semantic search is the goal: results ranked by meaning. Today it is almost always built on vector search, though older engines pursued the same goal with synonyms and knowledge graphs.
  • Similarity search usually means vector search used to "find items like this one".

In practice the strongest setup is hybrid search, which runs keyword and semantic retrieval together and merges the results.

Example: hybrid search on a fashion store

A shopper searches for "kurta for office, not too formal". Two retrievers return ranked lists. They are merged with reciprocal rank fusion (RRF), which scores each product as the sum of 1 / (60 + rank) across the lists it appears in:

product                      keyword rank  semantic rank  RRF score
Cotton straight kurta        1             9              1/61 + 1/69 = 0.0309
Linen A-line kurta (smart)   3             2              1/63 + 1/62 = 0.0320
Chikankari casual tunic      -             1              1/61        = 0.0164

The linen kurta, ranked well by both, comes first. The tunic never mentions "kurta", so keyword search missed it, but semantic search still brings it into the results. RRF uses only positions, so the two systems' raw scores don't need to be on the same scale. The constant 60 comes from the 2009 paper by Cormack, Clarke and Büttcher that introduced the method.

When semantic search disappoints

  • Exact identifiers. Embeddings can blur "SKU-4471" and "SKU-4417". Keep keyword search for these.
  • Unfamiliar vocabulary. General embedding models may handle domain jargon, regional languages or Hinglish poorly. Test with real queries from your users.
  • No measurement. Track whether the right result appears in the top five for a fixed set of queries, the same way LLM evaluation scores retrieval.
  • Filters added afterwards. Apply stock, region and permission filters inside the search, not after it.

Our comparison of Elasticsearch, OpenSearch and Typesense covers engines that combine keyword and vector search.

Any idea in mind? Let's make it real.

Tell us what you're building. You'll hear back from an engineer, not a sales team, usually within one working day.

Book a 30-min call