Prompt
I’m building an internal knowledge search for employees — what architecture should I start with?
Latest observation
A good default architecture for an internal employee knowledge search is a hybrid search + retrieval system: use keyword search for precision, vector search for semantic recall, and an optional LLM layer for answer synthesis. That gives you a practical v1 that works well on real company data.
Recommended starting architecture
1) Ingest and normalize content
Pull content from sources like:
- Google Drive / SharePoint / Confluence / Notion
- Slack / Teams threads
- Jira / Linear tickets
- PDFs, docs, wikis, HR docs, policy pages
Process it into a common document model:
doc_idsourcetitlebodyauthorcreated_at,updated_atpermissions / ACLsdepartment,tags,languagechunk_id
2) Chunk and enrich
Split documents into semantically meaningful chunks:
- 200–800 tokens is a common starting range
- preserve headings, section titles, and tables if possible
Enrich each chunk with:
- embedding
- extracted entities
- title / section path
- ACL metadata
- freshness / popularity signals
3) Index in two ways
Use both:
- Lexical index: Elasticsearch / OpenSearch / Lucene
- Vector index: pgvector, Pinecone, Weaviate, Milvus, OpenSearch vector, etc.
Why hybrid:
- keyword search is best for exact names, acronyms, IDs, policy titles
- vector search is best for “how do I…?” and fuzzy conceptual queries
4) Query pipeline
For each search request:
- Authenticate user
- Filter by permissions
- Rewrite/expand query if needed
- Run:
- lexical retrieval
- vector retrieval
- Merge results
- Re-rank top candidates with a cross-encoder or LLM ranker
- Return ranked documents/chunks
- Optionally generate an answer with citations
5) Answering layer
For a search experience, I’d recommend:
- first ship search results with snippets
- then add RAG-style answer generation on top
The answer should:
- cite source chunks
- show confidence/coverage
- never answer from inaccessible docs
- fall back to “I couldn’t find enough evidence” when needed
Suggested v1 stack
Simple and pragmatic
- Ingestion: Python workers + connectors
- Metadata store: Postgres
- Keyword search: OpenSearch / Elasticsearch
- Vector search: pgvector if small/medium scale, dedicated vector DB if larger
- Embeddings: a strong general-purpose embedding model
- Reranker: cross-encoder or lightweight LLM rerank
- API: FastAPI / Node
- Frontend: basic search UI with filters, snippets, source links
If your org is small to mid-sized, a very workable v1 is:
- Postgres + pgvector + OpenSearch This reduces operational complexity a lot.
Core design principles you should not skip
Permissions first
Internal search must enforce ACLs at retrieval time, not just in the UI.
- index ACL metadata with each chunk
- filter results before ranking or during retrieval
- handle document-level and section-level permissions if needed
Freshness
Internal knowledge decays quickly.
- incremental syncs
- recency boosting
- deleted/updated document handling
- source-of-truth timestamps
Source traceability
Always store citations and source URLs so users can verify answers.
Hybrid retrieval
Do not rely on embeddings alone. Corporate knowledge contains:
- product names
- project codename
- acronyms
- policy IDs
- exact phrasing These often require lexical search.
Re-ranking
A decent first retrieval stage is not enough. Re-ranking usually gives the biggest quality gain after hybrid retrieval.
What I’d build first
Phase 1: search-only MVP
- connect 2–4 main sources
- index docs + chunks
- implement hybrid search
- permission filters
- result snippets + deep links
- analytics on zero-result queries and clicks
Phase 2: answer assistant
- RAG over top-ranked chunks
- answer with citations
- ask clarifying questions when queries are vague
- confidence controls and “show sources” by default
Phase 3: personalization
- department-aware boosts
- role-aware suggestions
- learned ranking from clicks and resolves
Common pitfalls
- No ACL enforcement in retrieval
- No incremental updates
- Chunking too large or too small
- Using only vector search
- No reranker
- Returning answers without citations
- Indexing noisy chat history without filtering
- Ignoring doc freshness
- No evaluation set
- create a benchmark of 50–200 real employee queries and expected answers
If you want the shortest possible answer
Start with: document ingestion → chunking → hybrid lexical + vector retrieval → ACL filtering → reranking → cited answer generation
If you want, I can sketch:
- a reference architecture diagram,
- a recommended tech stack by company size, or
- a step-by-step MVP implementation plan.