Search API Design Decisions

Learn the workflow of a search API and important technical considerations that direct its design.

For a search API to work efficiently, there are a number of services operating at the backend. In the previous lesson, we learned a pivotal service (the search service) of the search API. A typical search API might utilize a few auxiliary services. We’ll consider some of them in this lesson. We’ll also look at some technical considerations that will help us to design an effective search API.

Design overview

Consider the following diagram to see how the search API interacts with a number of services when a search query is received.

Press + to interact
The end-to-end architecture of the search API
The end-to-end architecture of the search API

Let's discuss the role of each component and service shown in the diagram above.

Components and Services Details

Component or Service

Details

Search service

  • Performs searching, pagination, and sorting

Recommendation service

  • Recommends other search phrases related to the user's searched query


User service

  • Stores and provides user information to other services
  • Records the previous search history of users
  • Collaborates with the ads service for personalized ads
  • Interacts with the search service to filter or sort search results

Ads service

  • Returns advertisements based on the search query


API gateway

  • Authenticates and authorizes incoming requests
  • Throttles requests based on rate limiting
  • Caches the response to frequently made search queries
  • Routes the request to appropriate search, recommendation, and ads services

Database

  • NoSQL distributed database cluster to store the application data and index table

Note:  An alternative to the recommendation service can be the typeahead service but we avoided that functionality because it will increase the complexity of our design. Typeahead is a separate design problem, and we leave it to the learner for further exploration.

The following section discusses how each component and service in the search system interacts with each other to fulfill the client's request. ...