Preparing your design workspace

Loading the problem and your latest saved attempt…

Design a Local Business Review Site with Fast Tag Filters

Practice designing a local business review site where people search an area for businesses that have every tag they choose, sort by distance or rating, and write reviews that reach ratings and search results within a minute.

Problem statement

Design a local business review site in the style of Yelp, where people find businesses near them and read and write reviews.

For this exercise, assume each business has a name, an address and location, a category (such as restaurant or dentist), an average star rating, a review count, and a set of tags that describe it, such as 'outdoor seating', 'vegan options' or 'wheelchair-accessible restroom'.

A search gives a point and a radius of up to 25 km, an optional category, and up to 5 tags. Every result must have all of the chosen tags. Results are sorted by distance or by average rating, 20 to a page, and the user can page further.

Also assume a signed-in user can write one review per business, with 1 to 5 stars and text, and can edit it later. A business page shows the business, its tags, its average rating and review count, and its reviews, newest first. Only a business's owner can change its details and tags.

For this exercise, these are out of scope: free-text search, opening hours, personalized ranking, photos, review moderation and fake-review detection, ads, drawing the map, and running in more than one region.

What to build

  1. A user searches around a point within a radius, with an optional category and up to 5 tags, and gets the businesses that have all of those tags, 20 per page, sorted by distance or by rating.
  2. A user opens a business page and sees its details, tags, average rating, review count and reviews, newest first.
  3. A signed-in user writes or edits one review per business with 1 to 5 stars and text, and the business's average rating and review count reflect it.
  4. A business owner changes the business's details or tags, and searches reflect the change.

At scale

  • For this exercise, assume 20 million businesses, about 1,000 different tags, and about 15 tags on a typical business. A 5 km circle in a dense city center can hold 50,000 businesses.
  • For this exercise, assume 20,000 searches a second at peak, with the first page returned within 200 ms at the 95th percentile. Some tags are common (about 60% of businesses accept credit cards) and others are rare (about 1% have a wheelchair-accessible restroom).
  • For this exercise, assume users write about 1 million reviews a day and owners change about 200,000 businesses a day; a new or edited review, or a tag change, should show in search results and on the business page within 1 minute.
  • For this exercise, assume an accepted review is never lost and a user never ends up with two reviews of one business, even if the submit is retried.