Design Real-Time Typeahead for Enterprise Search: History, People, Docs, Apps, Filters
GleanFrontend Engineer · OnsiteLast updated
Design real-time typeahead for an enterprise search product that suggests past searches, people, documents, apps and filters as the user types. Tests client request policy and stale-response handling, accessible combobox UI, permission-aware backend fan-out, blending across sources and latency budgets.
In the system design round of a frontend engineer loop, the question was: how would you implement the typeahead search of the company's enterprise search product? As the user types into the search box, the product shows real-time suggestions drawn from several kinds of source:
- the user's search history,
- members of the user's organization (people),
- related documents,
- apps,
- filters.
Design the client and the service behind it.
Clarifying Questions
- Is the focus the client architecture, the backend, or both?
- What latency must suggestions meet, and on which devices and networks?
- How many suggestions are shown, and are they grouped by type or blended into one ranked list?
- What happens when the user picks each kind of suggestion: run a search, open a document, open a profile, launch an app, apply a filter?
- How large are the customer organizations, in people and documents per customer?
Hints
Hint 1
Latency is per keystroke: Count how many requests one search can generate as the user types, and decide which suggestions can be answered without any network call.
Hint 2
Not everyone may see every document: Think about what a suggestion reveals even before anyone clicks it.
Follow-up questions
- How would you personalize the ranking of people and documents for each user?
- How do you handle a source that is down or slow without blocking the others?
- How would you support typing in languages that use an input method editor?
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.