Swiggy
Hard
A user types “something light and spicy under ₹200 for two”. Design the search experience.
This is a query understanding question. Not a keyword search question. The query has four constraints. Two are hard, two are fuzzy, and one is ambiguous. Keyword search fails on all of them.
Step 1. Clarifying Questions
- Where is this typed? Assume the Swiggy food search bar, dinner time, Bangalore.
- Typed or voice? Assume typed.
- What does success look like? An order from this search, not just a click.
Why it matters: descriptive queries come from users who are hungry now and open to suggestions. Keyword search returns nothing, or dishes with "spicy" in the name. That is a lost order from a high-intent user.
Step 2. Break the query
- "Light": fuzzy. Not oily or heavy. Steamed, grilled, soups, salads, idli.
- "Spicy": a soft attribute. Chilli, Schezwan, Andhra, peri peri.
- "Under ₹200": a hard constraint, but ambiguous. Total or per person? Before or after delivery fee?
- "For two": quantity. Portions must feed two.
Step 3. Search lifecycle and the design at each stage
1. Understand: an LLM turns the text into structured filters: budget 200 total, people 2, spice high, heaviness low. Mark which are hard and which are soft. Resolve ambiguity with a default and show it as an editable chip: "₹200 total for food".
2. Retrieve: at dish level, not restaurant level. Dishes need attributes like spice level and heaviness. Tag menus offline with an LLM, and check against reviews ("too oily"). Combine structured filters for price with semantic search for meaning.
3. Rank: build combos that feed two under ₹200, like 2 plates of chilli momos at ₹180 (illustrative). Price maths is done in code, never by the LLM. Then rank by fit, rating, delivery time and the user's veg preference.
4. Present: show dish combos, not a restaurant list. One line of why: "Spicy, steamed, ₹180 for 2".
5. Refine: chips like "Less spicy", "Up to ₹300", "Veg only", and follow-up typing that keeps context.
Step 4. Failure points
- Wrong attribute: calling butter chicken "light". Fix with review signals and a judge eval on tags.
- Budget broken: a ₹260 combo shown. Fix with a hard filter in code.
- Zero results: relax soft constraints first (spice), never the budget silently. Tell the user what you relaxed.
Cross question: precision on hard constraints, recall on soft ones. Never show something over budget or non-veg to a veg user. But be generous on what counts as "light".
Step 5. Metrics
- North Star: search-to-order conversion for natural language queries
- Zero result rate, reformulation rate, time to add-to-cart
- Guardrails: % of results breaking a hard constraint (target zero), p95 search latency
Interview tip: say "hard vs soft constraints" out loud early. It shows you know what AI should flex on and what it never should.
Community Answers (0)
No answers yet. Be the first to share your approach!