You already know: lexical and embedding retrieval (D7), learning to rank and position bias (D7 and the ad case), and from the video feed case that hard policy belongs outside learned models. This case adds search tied to physical inventory: results must be available at the customer's store, inventory data is often wrong, and when an item turns out to be missing, a substitute must be chosen that the customer will accept and that never violates their constraints. The design questions: how to understand and retrieve, how to rank with biased feedback, how to choose substitutes safely, and how to keep search and substitution consistent.
How to read this lesson. No code, on purpose. Numbers marked assumed are assumptions you state out loud.
1. The prompt, and the questions that change the design
A mid-level answer: "embedding search with a ranker, and recommend similar items when something is missing". A staff candidate first asks how inventory is known and how often it is wrong, what queries look like, how substitutes are chosen and approved, and which constraints must never be broken. Those answers produce availability-aware retrieval, hybrid retrieval with query understanding, a learned acceptance model with customer preferences, and hard constraint filters outside every model.
Assumptions you state: