The 30 second answer
Retrieval decides which products are allowed into the candidate set using inverted indexes, filters, and maybe vectors. Ranking orders that smaller set with heavier features and models. Separating them keeps the expensive stage bounded and lets lexical and semantic recall improve without rewriting business rankers. I retrieve thousands of candidates cheaply, then re-rank a few hundred. Debugging also splits cleanly: missed item versus wrong order.
Relevant Search draws a clean line: matching decides membership in the result set; ranking orders members. Debug them separately. That split scales to modern stacks.
Retrieval (candidate generation). Goal: high recall under filters and a tight latency budget. Tools: inverted index Boolean/BM25 retrieval, field-centric or cross-field strategies for multi-attribute queries, and ANN over embeddings for vocabulary mismatch ("comfortable office sneakers" when titles say "loafer"). DDIA's vector chapter summarizes why exact flat search fails at scale and why IVF/HNSW-style ANN trades recall for speed.
Ranking. Goal: precision at the top of the page and business constraints. Features include text score, popularity, margin, stock, user affinity, position bias correction, and promotion eligibility. Compute this only on the candidate set. Zalando's public ranking paper uses a two-tower retriever (top 500) then a transformer ranker with multi-task heads and a policy layer — a concrete published example of the two-stage pattern.
Why separate (Opinion).
- Cost: deep models on the full catalog every request is impossible at marketplace QPS.
- Ownership: retrieval engineers tune analyzers/ANN; ranking engineers tune LTR/policy.
- Safety: filters and legal constraints belong in retrieval; "never show OOS as buyable" is a filter/policy, not a soft boost alone.
- Experimentation: you can A/B rankers without rebuilding inverted indexes.
Lexical vs neural. Zalando's 2018 cross-lingual DNN post and 2022 meetup talk frame neural search as enrichment for no-hit / vague queries alongside a classic pipeline — not a full replacement. Prefer "hybrid" language in interviews unless the prompt forces pure vector search.
Sources:
- Relevant Search — matching vs ranking (Ch3)
- DDIA — vector indexes / ANN (study map theme 2)
- arXiv 2409.02856
- Zalando Engineering — Cross-Lingual End-to-End Product Search with Deep Learning
- Elasticsearch — BM25 similarity