...

>

Design of Yelp

Design of Yelp

Define the detailed architecture for a proximity service like Yelp. Explore the necessary API design for search and data entry, and structure the storage schema using relational and key-value databases. Learn how specialized components like quadtree servers and aggregators handle complex geospatial search requests efficiently.

Following the requirements and estimations from the previous lesson, we will now focus on the API design, storage schema, and system building blocks.

API design

This section outlines the API endpoints for the system.

Search

The search function locates places based on categories (e.g., “cafes” ):

search(category, user_location, radius)

Parameter

Description

category

This is the type of search the user makes, for example, a search for restaurants, cinemas, cafes, and so on.

user_location

This contains the location of the user who’s searching with Yelp.

radius

This is the specified radius where the user is trying to find the required category.

Returns a JSON object listing items in the category within the specified radius. Each entry includes the place name, address, category, rating, and thumbnail.

To search for a specific place by name (e.g., “Burger Hut” ):

search(name_of_place, user_location, radius)

Parameter

Description

name_of_place

This contains the name of the place that the user wants to search for.

Returns a JSON object containing details of the specified place.

Add a place

To add a new place:

add_place(name_of_place, description_of_place, category, latitude, longitude, photo}

Parameter

Description

name_of_place

This contains the name of the place, for example, "Burger Hut".

description_of_place

This contains a description of the place. For example, "Burger Hut sells the yummiest burgers".

category

This specifies the category of the place—for example, "cafe".

latitude

This tells us the latitude of the place.

longitude

This tells us the longitude of the place.

photo

This contains photos of the place. There can be a single or multiple photos.

Returns a confirmation of the addition or an error message.

Add a review

To add a review:

add_review(place_ID, user_ID, review_description, rating)
...