Design Social Graph Search for Queries Like Friends Living in Seattle
Last updated: November 29, 2026
Quick Overview
Design a search backend that answers structured graph queries such as 'friends of mine who live in Seattle and like hiking', combining social edges with entity attributes and returning ranked results in under a second.
Meta
November 29, 20260
0
0 solved
Design a search backend that answers structured graph queries such as 'friends of mine who live in Seattle and like hiking', combining social edges with entity attributes and returning ranked results in under a second.
Meta built an in-memory graph search index for exactly these queries, and search-infra interviews revisit it. The interviewer checks whether you index edges as posting lists, plan queries as set operations, and push the social filter into the index instead of post-filtering.
What the Interviewer Expects
- Model graph edges and attributes as posting lists
- Translate queries into intersection and union operators
- Shard the index and plan scatter-gather
- Apply privacy checks efficiently
- Rank results by social and text signals
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- How do you answer 'friends of friends who work at X' without materializing all friends of friends?
- How do you keep the index fresh when someone moves cities?
- Where do privacy checks run and why?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Functional: queries combine edges (friend, follows, member-of) and attributes (lives-in, works-at, likes); results ranked; updates visible within minutes.
Non-functional: p99 under 500 ms; bi...
High-Level Design
Treat every edge type and attribute value as a term: friend:<uid>, lives_in:<city_id>, likes:<page_id>. Each term maps to a posting list of entity IDs, sorted by a static rank so the bes...