Design a Boolean Status Search Index
Design an unranked AND/OR text-search service over continuously ingested user statuses.
Problem statement
Design a service that accepts user-authored text statuses and supports unranked Boolean searches containing AND and OR term conditions.
Normalize and tokenize new statuses asynchronously, maintain sorted status-ID posting lists, and answer queries through posting-list intersection or union, with skip pointers when useful. Compare term-based consistent-hash sharding with document sharding and scatter-gather.
For this exercise, assume status edits create a new indexed version, deletions must disappear from new searches, one billion retained statuses, 20,000 writes per second, 50,000 searches per second, and 30-second p95 index freshness.
Explain durable ingestion, query semantics, sharding, rebalancing, deletion, privacy, and recovery.
What to build
- Accept an idempotent status version and make its normalized searchable terms visible asynchronously.
- Return status IDs satisfying a bounded AND/OR term expression without relevance ranking.
- Remove deleted or superseded status versions from new results while preserving auditable ingestion state.
At scale
- Source-backed behavior: normalized terms map to sorted posting lists that are intersected or unioned, optionally with skip pointers.
- Source-backed design pressure: compare term-sharded posting lists with document sharding and scatter-gather.
- Practice assumption: retain one billion statuses, ingest 20,000 versions per second, and serve 50,000 searches per second.
- Practice assumption: accepted writes and deletions should affect p95 search results within 30 seconds.