Design Google Search: crawling, indexing, and ranking
Google Search
Guided ModeAutocomplete: Prefix Trie and Trending Injection
Request Flow
Per-keystroke requests hit Redis
Every character the user types fires a request to the Autocomplete Service. The service looks up the typed prefix in a Redis sorted set of pre-scored query completions. Redis lookup is under 2ms. No inverted index involved.
Trending Engine injects real-time signals
The Trending Engine consumes the live query stream from Kafka, counts frequencies in a 15-minute sliding window using Count-Min Sketch, detects velocity spikes, and writes trending completions to Redis sorted sets within seconds.
Autocomplete is fully decoupled from search
The autocomplete pipeline never touches the inverted index or the ranking service. It is a completely separate read path with a 20ms latency budget.
Key Insight
Autocomplete is the fastest path in Google Search. It is a completely separate optimised pipeline that never touches the index — only possible through strict service decomposition.
Step 4 of 4
