DOCUMENT SEARCH & ANSWERS

Keyword vs semantic vs hybrid search

Keyword search finds the words you typed. Semantic search finds what you meant. Hybrid does both and ranks them together, which is why it is usually the one to reach for.

Engineering Business COMPARISON 7 min read
Keyword · the words
"expense reimbursment"
mode keyword
  • Expense reimbursement · filing deadlinep. 29
  • Expense Reimbursement Guidep. 13
  • Forgives the typo
  • Exact on names, codes and numbers
  • Misses the same idea in other words
Semantic · the meaning
"getting paid back for a client trip"
mode semantic
  • Filing deadline and claim preparationp. 29
  • Worked example for a taxi claimp. 34
  • No shared words needed
  • Survives rephrasing, even another language
  • Loose on exact codes and names
Hybrid · both, fused
"deadline to claim taxi expenses"
mode hybrid
  • Filing deadline and claim preparationboth
  • Worked example for a taxi claimmeaning
  • Local taxis and ride-hailingwords
  • One ranking from both
  • A match on both comes first
The words, the meaning, or both in one ranking.

Three ways to match a question to a page

Type something into a search box over documents and one of three things happens underneath. The system looks for your words. Or it looks for your meaning. Or it does both and has to decide how to rank what the two found. The three are called keyword, semantic and hybrid search, and the difference between them is the difference between a search that works when you already know the answer's wording and one that works when you do not.

The examples below all ask the same thing of the same handbook: where does it say how long I have to file an expense claim? The passage that answers it sits on page 29, under the heading "Filing deadline and claim preparation".

Keyword: the words on the page

Keyword search is the kind everyone has used. The documents were broken into words when they were indexed; the question is broken into words now; passages that contain those words are scored by how many they contain and how rare the words are. Type "expense reimbursment", with the typo, and a good keyword search still finds the section, because it matches terms within an edit or two of what was typed. It finds page 29 and the Expense Reimbursement Guide on page 13 of the processes manual, and it can highlight the matching words in each.

Its strength is precision. A contract number, a person's name, a product code or an exact phrase is found exactly, and nothing that merely resembles it is returned. Its weakness is the mirror image: it cannot find what was said in other words. A search for "getting paid back" finds nothing in a handbook that only ever says "reimbursement". Full-text search vs database LIKE explains the machinery.

Semantic: the meaning behind them

Semantic search starts from a different idea. When each passage was indexed, an AI model read it and produced a long list of numbers, called an embedding, that works like a coordinate: passages about similar things get coordinates that are close together. The question is given a coordinate the same way, and the search returns the passages nearest to it.

Nearness in meaning does not need shared words. "Getting paid back for a client trip" has no word in common with the filing deadline passage, and lands right beside it; it also finds the worked taxi example on page 34. It survives rephrasing, synonyms, and to a useful degree other languages: a question typed in one language can find a passage written in another, with a lower score.

Two things make semantic search less than a replacement for keywords. It is loose about exactness: to a model, two invoice numbers that differ by a digit mean almost the same thing. And "nearest" always exists. Ask about something no document covers and there are still nearest passages; they are simply not near. A careful system sets a minimum similarity and returns nothing below it, rather than the best of a bad lot.

Hybrid: one ranking from both

Hybrid search runs the question both ways and merges the results. A passage can qualify on its words, on its meaning, or on both, and the two scores are combined into one, so the list is ranked once rather than shown as two lists. Ask for the "deadline to claim taxi expenses": the filing deadline passage matches on words and meaning and comes first; the taxi example matches mostly on meaning; a section on local taxis and ride-hailing matches mostly on words.

The effect is that each method covers the other's blind spot. The exact code still wins because its words match exactly. The differently worded policy is still found because its meaning matches. And a passage that satisfies both, which is usually the one you wanted, rises above everything that satisfies only one.

Side by side

CriterionKeywordSemanticHybrid
What it matchesThe words in the textThe meaning of the textEither, ranked together
A typo in the questionForgivenWithin an edit or twoMostly harmlessForgiven
The same idea, other wordsMissedFoundFound
Names, codes, numbersExactLooseINV-2041 and INV-2014 look alikeExact, through the words
A question in another languageMissedOften foundWith a lower scoreOften found
Highlights the matchThe matching wordsNothing to highlightWhere words matched
Needs an AI modelNoYesTo index and to searchYes
Typical missThe right passage, phrased differentlyA near neighbour that is not really about itRare; costs a little more per search

When each is right

Keyword, when you know the words. You are looking for a named thing: a clause number, a supplier, a form code, a phrase you remember reading. You want that and nothing like it. Keyword search is also the only one of the three that needs no AI model, so it is what remains when AI is not configured, and it is the fastest.

Semantic, when you can describe it but not quote it. You know what the document is about and have no idea how its author put it, or you are asking in everyday language about something written formally. It is also the mode that helps a new employee, who does not yet know that "getting paid back" is filed under "reimbursement".

Hybrid, when you are not sure, which is most of the time. People rarely know in advance whether their words will match the document's. Hybrid costs slightly more per search and asks nothing of the person searching. It is the sensible default for a search box and the right way to pick passages for an AI assistant.

What do you know about what you are looking for?
  1. You know the exact words, a name or a codeKeyword
  2. You can describe it, but not quote itSemantic
  3. You are not sure how it was writtenHybrid
Pick by what you know. When in doubt, hybrid.

What semantic search needs

Keyword search needs only the text. The other two need a model, twice: once when a document is indexed, to give every passage its coordinate, and again at search time, to give the question one. Both have to come from the same model, because coordinates from different models do not share a map. That has a practical consequence: documents indexed before a model was configured have no coordinates, and are found by keyword only until they are indexed again.

It also has a consequence for where text travels, since producing those coordinates means sending passages to the model. What leaves your environment when AI reads your documents sets that out.

One more distinction: documents and passages

Each mode can be pointed at whole documents or at passages, and the choice matters most for semantic search. A document's coordinate is usually taken from its summary, a few sentences about the whole thing, so a detail buried in a long document will not be found by searching documents by meaning. Search the passages for that, or use hybrid. Searching documents answers "which files are about this"; searching passages answers "where does it say so".

What to ask a vendor

"AI-powered search" can mean any of the three. Ask which modes exist and which one the search box uses by default. Ask what happens when the question has no good match: nothing, or the nearest irrelevant passage. Ask whether a search for an exact code returns that code first. And ask which model produces the embeddings, where it runs, and whether keyword search still works without it.

Under the hood

Keyword scoring is typically BM25: term frequency, weighted by how rare the term is across the collection and normalized for passage length, with fuzzy matching bounded by edit distance. Semantic search is a k-nearest-neighbour query over a vector field, scored by similarity between 0 and 1. Because a KNN query returns the K nearest records however far away they are, a similarity floor is what turns "nearest" into "relevant"; the right floor depends on the embedding model and on what the vector stands for, a passage or a document summary.

Fusion needs the two scores on one scale. One workable form saturates the keyword score into the range 0 to 1, rescales the similarity above its floor into the same range, and takes a weighted sum, so a record matching both sides outranks a record matching either. Access scope has to be applied inside the nearest-neighbour clause, not after it; filtering afterwards returns fewer than K results, drawn from neighbours the person was never allowed to see.

See it on real data.

The demo instance runs dashboards, data grids and the AI Assistant on real business data. No sign-up.