Design an AI-Powered Search Index
Design the multi-tenant indexing and retrieval boundary for lexical and semantic document search with fresh ACL enforcement and safe ranking fallback.
Problem statement
For this exercise, assume a multi-tenant productivity product contains documents with text, metadata, owners, projects, and changing access policies. Authorized users issue lexical, semantic, or hybrid queries with bounded filters and receive ranked document summaries.
The system owns versioned ingestion, text and vector projections, access-aware candidate generation, ranking, stable pagination, index rebuilds, and deterministic degradation; editing, embedding-model training, answer generation, and recommendations are outside scope.
Searchable content should refresh within one minute, current access must remain fail closed, and healthy queries should meet a 250-millisecond p95 target.
Design the write and query contracts, index partitioning, lexical and vector retrieval, ACL enforcement, ranking and fallback, cache identity, rebuild and migration protocol, failure recovery, and observability.
What to build
- The service consumes versioned document, metadata, project, membership, and access changes into rebuildable lexical and vector projections.
- An authenticated user can run lexical, semantic, or hybrid search with bounded filters and receive only currently readable document summaries with stable pagination.
- The service ranks authorized candidates with versioned signals and returns a labeled deterministic lexical-and-recency fallback when semantic retrieval or ranking misses its budget.
- Operators can build, validate, switch, roll back, and reconcile index generations without leaking stale access or losing accepted document versions.
At scale
- For this exercise, assume 100,000 tenants, one billion documents, and highly skewed tenants with up to fifty million documents.
- Support 10,000 search requests and 50,000 document, metadata, membership, or access updates per second at peak.
- Target 250 milliseconds p95 for healthy searches, 400 milliseconds p95 for degraded fallback, and make ordinary content searchable within 60 seconds.
- Enforce access revocation within five seconds, fail closed when current access is uncertain, and preserve accepted index changes through a zone failure.