Problem Statement: Social Search at Twitter Scale
Problem Statement: Social Search at Twitter Scale — social search interview depth
Problem Statement: Social Search at Twitter Scale
Design platform-wide social search like Twitter/X, Facebook, or LinkedIn: users type a query and retrieve posts, people, hashtags, photos, and videos with typo tolerance, synonyms, and filters (date, media type, from-user). The product is not a standalone search engine—it is the discovery layer on top of an existing social graph and content graph.
Interviewers expect you to separate read-heavy query path (p95 < 200ms) from write-heavy indexing path (seconds of lag acceptable with clear SLA). You must explain how a new post becomes searchable without blocking the publish API.
Phase lens (understanding)
Frame the product as discovery on a social graph—not a standalone web search engine.
Operational detail (sec-01)
Document visibility rules early: blocked users, deleted posts, and NSFW tags must filter at index time and query time. Use monotonic version on post_id so out-of-order Kafka events cannot resurrect deleted content.
Failure modes unique to this step
Viral hashtag saturates one shard; suggest trie poisoned by bot queries; cross-region replication lag shows stale results after move—mitigate with rate limits, suggest sanitization, and X-Index-Lag-Sec response header.
Interview checkpoint
State one outage story for "Problem Statement: Social Search at Twitter Scale" (stale index, hot shard, typo spam) and the control that limits blast radius.
1 public record SearchCursor(String searchAfterScore, String docId, long sessionTtlMs) { 2 public SearchCursor { 3 if (sessionTtlMs < 0) throw new IllegalArgumentException("ttl"); 4 } 5 }
1 def blend_scores(post: float, people: float, tag: float, intent: str) -> float: 2 weights = {"posts": 1.0, "people": 0.9, "hashtags": 0.7} 3 base = post * weights["posts"] 4 if intent == "people": 5 base = max(base, people * 1.2) 6 return base + 0.15 * tag
1 export function normalizeQuery(raw: string): string { 2 return raw.normalize("NFKC").trim().slice(0, 512).toLowerCase(); 3 }
Why interviewers care
Social Search interviews reward freshness vs relevance trade-offs, privacy-aware ranking, and honest capacity math—not a generic Elasticsearch rectangle.
Key Highlights
- •Unique angle for sec-01: Problem Statement
- •Posts + people + hashtags with privacy-aware filters
- •Kafka-backed indexing with monotonic post versions
- •p95 200ms query / 30s index lag targets
Section Rescue Kit
Buzzwords to use:
Safe statements:
- "For Problem Statement: Social Search at Twitter Scale, I will quantify QPS and TB before naming OpenSearch vs managed vendor."
- "I can diagram publish → Kafka → indexer → alias swap separately from query path."