Skip to main content

System design answer

Enterprise search with permissions

Connectors that sync content and permissions, permission-aware retrieval inside the search, and grounded answers with citations.
The question“Design an AI search assistant over a company's SharePoint, Jira and Google Drive, where each employee sees only what they are allowed to.”

1Clarify0-5 min

Ask before you draw. These answers change the design.

  • Which sources, how many documents, how often do they change?
  • How are permissions defined, and how fast must a revoked permission take effect?
  • Do we answer questions or only find documents?
  • Single sign-on provider?

2Requirements and numbers5-8 min

It must

  • Search and answer across sources with citations
  • Respect each source's access rights
  • Show freshness and the source of every answer

And it must be

  • A revoked permission applies within 10 minutes
  • p95 answer under 6 s
  • Audit log of who asked what and what was retrieved

Numbers to say out loud

Corpus
2 million documents, about 40 million chunks
Users
20,000 employees, peak 50 queries a second
Change rate
About 30,000 documents changed a day

3High-level design8-12 min

  1. SharePoint → delta sync → Connectors
  2. Jira → modified since → Connectors
  3. Google Drive → changes API → Connectors
  4. Connectors → Parse, chunk, embed
  5. Parse, chunk, embed → Index with allowed groups
  6. Employee → SSO → API
  7. API → Verified groups
  8. Verified groups → Hybrid search filtered by groups
  9. Hybrid search filtered by groups → Index with allowed groups
  10. Hybrid search filtered by groups → Rerank
  11. Rerank → Model
  12. Model → Answer with citations

4Deep dives12-26 min

Permissions

Store allowed users and groups on every chunk; filter inside the search before ranking; a chunk with missing permissions is visible to nobody. Re-sync permissions every 10 minutes and on webhook events, separate from content sync.

Connectors

Incremental sync with delta tokens, page through results, back off on 429s, resume after failure, and handle deletions. Every run logs read, added, changed, deleted and failed counts.

5Failures26-30 min

What can go wrongWhat stops it
A leak through stale permissionsFast permission sync, deny by default, and an alert when sync lags
Connector falls behindLag metric per source and a backfill job
Answers mix old and new versionsVersion metadata and filters for the latest

6Evals and monitoring30-33 min

  • Access tests: users from different groups must never see each other's restricted chunks
  • Golden set of 200 questions with the expected source documents
  • Freshness: time from edit to searchable

7Trade-offs33-35 min

  • Filtering inside the search costs some speed but prevents leaks
  • Answering vs only finding: answers are useful but need grounding and evals

Follow-ups to expect

  • What happens when someone leaves a group?
  • How would you search scanned PDFs?

Practise out loud in the mock interview

Today's AI turns are used

Lessons, roadmaps, videos, practice cards and the code playground stay free with your account, with no limit.