Design Uber Eats-style search function
Company: Uber
Role: Software Engineer
Category: System Design
Difficulty: hard
Interview Round: Onsite
Design the search function for a large-scale food delivery platform similar to Uber Eats.
A user opens the app and types queries such as:
- Restaurant names (e.g., "Joe's Pizza"),
- Cuisines (e.g., "Thai", "Sushi"),
- Dish names (e.g., "cheeseburger", "pad thai").
The system must return a ranked list of relevant restaurants (and possibly dishes) that can deliver to the user's location.
### Requirements
**Functional requirements**
1. Users can search by:
- Free-text query (restaurant name, cuisine, or dish).
- Current location; results should be only from restaurants that deliver to that area.
2. Support filters and sort options, such as:
- Open now / closed.
- Price range, rating, delivery time estimate, distance.
3. Results should be ranked by:
- Text relevance.
- Distance / delivery ETA.
- Restaurant popularity and rating.
- (Optionally) user personalization.
4. Data changes that affect search:
- New restaurants and menus being added.
- Menu or availability changes (e.g., items out of stock, restaurant closed/open) should reflect in search reasonably quickly.
**Non-functional requirements** (assume a large city / multi-city deployment)
1. Low latency: P95 search latency under ~200 ms from the service (excluding network to client).
2. High availability: search should continue to work even if some components fail.
3. Scalability: support millions of users, tens/hundreds of thousands of restaurants, and high queries per second.
Describe the **high-level design** of such a system, covering:
- Overall architecture and major components.
- Data modeling and indexing strategy.
- Query flow from the client to returned results.
- How you keep the search index fresh when restaurants/menus/availability change.
- Approaches to ranking and personalization.
- Scaling and reliability considerations.
Quick Answer: This question evaluates a candidate's ability to design scalable, low-latency search systems for a large-scale food delivery platform, testing competencies in system architecture, data modeling, indexing, query flow, freshness mechanisms, ranking, and personalization.