Functional
- Return ranked suggestions for a normalized prefix.
- Respect locale, safety policy, and product availability.
- Continuously incorporate popularity and catalog changes.
Return useful ranked suggestions within a keystroke-scale latency budget.
Serve from memory with regional replicas.
Compress shared prefixes and tier the long tail.
Client debounce, cancellation, and cache matter.
Use separate fast safety overlays and slower full builds.
These are reference assumptions, not universal facts. In an interview or architecture review, change them when the product context changes.
/v1/suggest?q=&locale=&limit=Return ranked suggestions and index version./v1/eventsIngest privacy-safe impression and selection signals./v1/terms/{id}Urgently suppress a term through the policy overlay.locale+prefix, candidate_ids, base_scores, snapshot_versionCompact top-K list keeps serving bounded.id, display_text, features, policy_flags, valid_untilSeparate text/features from repeated prefix postings.Enforce latency and safety budgets
Map prefixes to candidates
Blend popularity and context
Continuously publish new index snapshots
A compressed trie or finite-state transducer shares prefixes; each node stores a bounded top-K candidate list. Partition first by locale, then by prefix range or hash while keeping common prefixes replicated.
Retrieve a few dozen candidates, apply hard policy and availability filters, then use a small model to rerank. Enforce a strict deadline and return base popularity order if features or model are late.
Build immutable snapshots, validate offline quality/safety, canary by traffic slice, then atomically switch a version pointer. Emergency suppressions live in a tiny overlay that updates independently.
Return cached popularity results instead of timing out the request.
Canary snapshots and atomically roll back the active version.
Move here when: Small corpus and modest QPS.
Move here when: Latency and query load rise.
Move here when: Quality and market-specific relevance matter.
Strong answer signal: Replicate/cache hot nodes, cap candidates, and apply stronger rate limits.
Strong answer signal: High-priority deny/suppression overlay checked at serving time.
Strong answer signal: Deadline, circuit breaker, and deterministic base-ranking fallback.