In this chapter
We'll meet metadata, filtering, and hybrid search — combining a real semantic similarity score with an exact structured filter (in stock, under a price) — plus keyword + semantic search as the same idea applied to blending Act 7's full-text search with this Act's meaning-based one.
The Problem in Real Life
"Cozy jacket for cold weather" correctly finds the Insulated Winter Coat. Mike adds one real constraint: "only if it's actually in stock, and under $60." Meaning-based similarity has no idea what "in stock" or "$60" even are — those aren't part of what a sentence means, they're facts about the product.
Sarah realizes semantic search alone was never going to be the whole answer. It needed to be combined with something else this course has already built.
Meaning gets us the right kind of product. It doesn't know what's actually in stock.
Mike
Meaning Alone vs. Meaning Plus Real Constraints
Metadata is structured fact, not meaning
Price, stock, category — real, exact data about a product, separate from what its description means.
Filtering stays exact, as always
price < 60 AND inStock = true — the same plain, familiar condition from every earlier database in this course.
Hybrid search combines both signals
A real semantic score alongside a real metadata filter — using each mechanism for what it's actually good at.
Keyword + semantic, blended
Sometimes the exact typed word matters (a brand, a model number); sometimes only the meaning does — a real system blends both.
Hybrid Search & Metadata Filtering
Metadata is exactly this: real, structured facts about a product — price, stock count, category — separate from the free-text meaning an embedding captures. Filtering on metadata is the same familiar operation from every earlier database in this course: price < 60 AND inStock = true, a plain, exact condition, nothing fuzzy or semantic about it.
| Product | Semantic Score ("cozy jacket") | In Stock? | Price | Passes Filter? |
|---|---|---|---|---|
| Insulated Winter Coat | 0.68 | No | $79 | No — out of stock |
| Waterproof Hiking Jacket | 0.60 | Yes | $49 | Yes |
| Fleece-Lined Parka | 0.55 | Yes | $95 | No — over $60 |
Ranked by meaning alone, the Insulated Winter Coat wins. Once the real constraint (in stock, under $60) is applied, it's correctly excluded, and the Waterproof Hiking Jacket — a genuinely relevant, second-best semantic match — becomes the right answer to actually show.
This combination — a real semantic similarity score alongside a real metadata filter — is hybrid search: not choosing between meaning-based and exact matching, but using both together, each for what it's actually good at. A closely related idea, keyword + semantic search, combines this course's Act 7 (fuzzy, keyword-based full-text search) with this Act's own meaning-based search in the same query — sometimes the exact word a customer typed genuinely matters (a specific brand name, a model number), and sometimes only the meaning does; a real hybrid system blends both signals into one final ranking rather than forcing an either-or choice.
Worth being precise about honestly: this course's own Vector Playground's documents are just {id, text} — no metadata fields at all, narrower even than Act 7's own Search Playground. The table above is a real, correctly-computed illustration (0.68 and 0.60 are genuine scores from this Act's own earlier chapters), not something this specific teaching tool can run end-to-end. A real production vector database (and most hosted vector search products) genuinely supports attaching metadata to each vector and filtering on it directly, in the same query as the similarity search itself.
Key Takeaway
Semantic similarity finds the right kind of match. It has no concept of price, stock, or any other hard fact — hybrid search is what makes "the right kind of product, that's actually available and affordable" a single real query, combining a fuzzy, meaning-based score with an exact, structured filter rather than picking one or the other.
Why This Matters
A real shopping assistant is useless if it recommends something out of stock or double the customer's budget — hybrid search is what actually makes semantic search production-usable, not just a impressive demo against a handful of documents.
GreenMart now has a name for combining meaning-based ranking with real, exact constraints. None of this has addressed what actually happens once a matched product's description gets handed to an AI assistant to answer with, though — exactly where the next chapter goes.
