Preparing your design workspace

Loading the problem and your latest saved attempt…

Design Grocery Product Search Ranking

Build search ranking for a grocery delivery app from launch day, with no search history, into a staged system of retrieval and learned rankers, and explain the model and loss behind each stage.

Problem statement

For this exercise, assume a grocery delivery app where a shopper first picks a store that delivers to their address and then searches that store's products, for example "oat milk" or "chicken thighs".

Each store carries its own subset of a shared product catalog, and an existing inventory service publishes how likely each product is to be in stock at each store.

You are building search ranking from scratch: on launch day there are no search logs at all, although the catalog has product text, brand, category and size, and the ordering system knows how often each product sells at each store.

Design the whole search ranking system and how it grows from that cold start into a staged system: finding candidate products, ranking them, logging what shoppers see and do, training models, and releasing ranking changes safely.

For each component, say which model you would use and what it is trained to optimize, including the loss function. A product the store does not carry must never appear, and a product the inventory service marks as unavailable must not be shown as available.

Sponsored products and ads, the inventory model itself, checkout, and typeahead suggestions are outside scope.

What to build

  1. A shopper searches the selected store and gets up to 50 ranked products that the store carries, with each product's availability shown honestly.
  2. On launch day, with no search logs, search already returns relevant products using catalog data and store sales counts.
  3. The system logs what each search showed and what the shopper then added to the cart or bought, and uses that data to train ranking models with stated objectives and losses.
  4. A ranking change is measured offline and in an online experiment before it reaches all shoppers, and search keeps working when a model or feature is unavailable.

At scale

  • For this exercise, assume about 1,500 stores, each carrying 20,000 to 60,000 products from a shared catalog of about 2 million products, with each store-product in-stock likelihood refreshed about every 30 minutes.
  • For this exercise, assume up to 5,000 searches per second at peak and a 200 ms p95 target for a page of 50 ranked products.
  • For this exercise, assume there are zero search logs at launch; traffic ramps up over the first few weeks, and at the full load above search logs billions of searches a month, with only a minority of searches ending in an add-to-cart.
  • For this exercise, assume ranking models retrain daily, and a ranking change reaches all shoppers only after offline checks and an online experiment.