Detailed Design of the Typeahead Suggestion System

Lesson 166 of 25610 min readPremium lesson preview
In this lesson3 sections

Detailed Design of the Typeahead Suggestion System

Detailed design

The illustration below outlines the flow and interaction of the system components. The design consists of two main parts:

  • Suggestion service

  • Assembler

The detailed design of the typeahead suggestion system
The detailed design of the typeahead suggestion system

Suggestion service

As a user types a query, getSuggestions(prefix) API calls reach the suggestion service. The service retrieves up to ten eligible candidates from Redis, using a key that includes the normalized prefix, locale, and relevant index version. On a miss, read the serving trie or another prepared index, then populate the cache. Aggregated counts in Cassandra are build inputs, not a reason to rebuild a trie during a user request.

Assembler

The rest of this lesson is for Premium members

Premium opens every lesson in this course, along with all questions and solutions on PracHub.