Design a Search Auto Completion function

Difficulty: MEDIUMCategory: LLDFrequency: 1Asked On 2025-01-17

Problem Statement

Design a system that provides real-time search suggestions as the user types a query. This system should be capable of handling millions of queries per day and must respond in milliseconds.


Functional Requirements:

•Return top k suggestions based on user input prefix.
•Suggestions should be ranked by popularity or relevance.
•Support personalized suggestions (optional stretch).
•Support dynamic updates to the suggestions list.


Constraints:

•High availability and low latency.
•Scalability to serve a global user base.
•Dataset may grow frequently (new terms, user behavior).



Solution

Comments