What is Query by Example?
Query by Example (QBE) retrieves results using a sample item (product page, image, text snippet, or spec sheet) instead of a typed keyword. The engine converts that example into features—attributes, text tokens, and/or vectors—then finds nearest neighbors.
How It Works (quick)
- Feature building: Extract structured attributes (brand, size, material), text signals (title bigrams), and embeddings (image/text).
- Candidate recall:
- Attribute match (parametric filtering).
- Lexical match (BM25 on title/attributes).
- Dense retrieval (ANN over vectors).
- Re-rank: Combine similarity with business signals (price, stock, rating, margin).
- Explain: Show which attributes/visual cues drove the match (“same membrane,” “similar silhouette”).
Why It Matters in E-commerce
- Zero-typing discovery: Great for mobile and vague needs (“I want this vibe”).
- Long-tail rescue: Finds alternates when keywords don’t align.
- Substitution & upsell: Suggest in-stock or higher-margin equivalents.
Best Practices
- Hybrid similarity: Blend attribute, lexical, and vector signals.
- Freshness: Refresh embeddings on content changes; demote OOS variants.
- Controls: Size/fit/compatibility filters first; add price/brand caps to avoid wild jumps.
- UX: “More like this” button on PDPs; chips to tweak brand/price/size.
- Metrics: CTR@k, conversion, attachment rate, and “OOS → substitute” saves.
Challenges
- Stale embeddings, look-alike but wrong fit, image background noise, and cold-start items.
Examples
- Upload boot photo → returns waterproof trail boots with similar silhouette and GORE-TEX tag.
- PDP for GPU → QBE shows compatible power supplies and cables.
Summary
QBE turns a product or image into a powerful search. Use hybrid similarity with clear guardrails to surface close, in-stock alternatives users will actually buy.