Two Kinds of Search, Two Kinds of Failure
Part of the free Generative AI course on LogicWiz, module: Finding the Needle: Hybrid Search & Retrieval.
Episode 39: One Search, Two Ways to Fail
"Nova, find me a bright lamp for late-night reading." She returned a a wall poster, a coffee mug, and — buried at #40 — the actual fan. "The answer exists," Priya said. "She just can't find it."
Nova Runs the Store Now
LogicWizNews grew a marketplace, and Nova is its search box. A shopper types a few words; Nova has to surface the right product out of a catalogue of hundreds of thousands. Simple, until you watch real people type.
A shopper searches "bright lamp for late-night reading." The perfect product is sitting in the catalogue — titled "LumaGlow 1100-Lumen LED Desk Light." Nova has to connect those two, and the way she searches decides whether she can.
There are exactly two ways to search text, and today you'll watch each one fail in its own way — which is the whole reason the rest of this chapter exists.
The Two Kinds of Search
Every retrieval system leans on one of two ideas. You met both in Chapter V; here's the one-line refresher:
- Sparse (keyword / lexical) search matches exact words. "paywall" finds documents containing "paywall." It's the classic search-engine trick — fast, precise, and completely literal.
- Dense (semantic) search matches meaning. It turns text into an embedding (a vector of numbers) and finds text whose vector is close by — so "bright" lands near "luminous," "radiant," "well-lit."
🧭 A quick vocabulary anchor you'll need all chapter: sparse vectors are mostly zeros (one slot per vocabulary word, only a few lit up); dense vectors are short and fully packed with numbers. Sparse = words. Dense = meaning.
Where Keyword Search Falls Down
Arjun tries the obvious thing first: match the shopper's words against product text.
The shopper typed "bright lamp for late-night reading." The right product is "LumaGlow 1100-Lumen LED Desk Light." Not one word overlaps. Keyword search sees zero matches and moves on — the correct answer is invisible because the shopper and the catalogue used different words for the same thing.
This is the vocabulary-mismatch problem, and it's everywhere real humans type:
- "paid but still locked out" vs "access not provisioned"
- "big cats from the African plains" vs "lions native to the savanna grasslands"
- "card declined" vs "payment failed"
{{visual:keyword-vs-semantic}}
⚠️ Keyword search matches characters, not concepts. It has no idea that "bright" and "luminous" mean the same thing. On messy human text, it misses most of what matters.
Where Semantic Search Falls Down
"Fine," says Arjun, "use meaning instead." So he switches to dense/semantic search. Now "bright lamp for late-night reading" correctly finds the LumaGlow lamp — meaning matched.
Then a shopper searches for "1100 lumen" — a precise technical spec — and semantic search hands back a pile of loosely related lighting products, ranking the exact "1100 lumen" model no higher than a "110 lumen" one. Dense embeddings are brilliant at vibes and terrible at exact identifiers: model numbers, SKUs, brand names, "1100 lumen." Meaning blurs the very details a spec-shopper cares about.
There's a deeper reason, worth naming now because it drives the whole chapter:
- A dense embedding is destructive — it melts the text into numbers that capture the gist, and you can never recover the exact original words. Great for meaning, blind to specifics.
- A sparse embedding is reversible — every non-zero slot maps back to a real word, so it never loses the literal term "1100 lumen."
Precision vs. Recall: Naming the Trade-off
These two failures have names that you'll use for the rest of your career. Imagine 30 products in the catalogue are truly relevant to a query.
- Precision = of what you returned, how much was actually relevant. Keyword search has high precision (its exact matches are usually right) but low recall (it misses everything phrased differently).
- Recall = of everything relevant, how much you found. Semantic search has high recall (it catches paraphrases) but lower precision (it also drags in loosely-related noise).
{{visual:precision-recall}}
You'll implement both of these fractions yourself in this lesson's lab — they're the yardstick every retrieval fix in this chapter gets measured against.
📌 The core tension of this chapter in one line: lexical search is precise but narrow; semantic search is broad but fuzzy. Neither alone is enough for real search.
Which Search for Which User?
There's no universally "right" choice — it depends on who's searching and for what:
| Use case | What users type | Best fit |
|---|---|---|
| Code / error-log search | exact lines, error codes | Keyword |
| Mental-health forum | feelings, vague descriptions | Semantic |
| Store / marketplace | brand + spec and fuzzy intent | Hybrid |
Domain experts (doctors, developers) type precise jargon → lexical shines. General users type loose natural language → semantic shines. A store has to serve both at once — which is exactly where hybrid search earns its name.
What Nova Learns Next
Nova now knows why one search isn't enough. But before she can combine them, she has to make each one work at scale — hundreds of thousands of vectors, answered in milliseconds. In Episode 40, we tackle the speed problem: how dense search stays fast when brute force can't.