Prepare documents for a knowledge assistant
Retrieval-augmented generation searches approved sources first. The language model then drafts an answer from the passages it receives.
Lessons in this path
How to do it
- Choose a collection with a named owner. Check dates, versions, scope and permissions. Remove obsolete copies or label them as historical.
- Split long documents at useful boundaries, such as headings, workflow steps or FAQ entries. Retain the source, section, version and access group. A returned passage should make sense on its own.
- Compare exact-term and semantic search on your own questions. Product codes and specific titles can benefit from keyword matching. Semantic search can help when people paraphrase the source.
Situation · AI for enterprises
Several business units want a policy assistant. Document owners, languages and access differ by collection.
Apply this in your organization
Map documents to units, roles and local validity. Make versioning and access revocation verifiable.
How do you prepare a document collection step by step?
The quality of a knowledge assistant is largely decided before the first line of code. A model can only answer as well as the retrieved passage allows. The sequence below works for collections from a few dozen to a few thousand documents.
- Inventory: list every storage location (drives, wiki, ticket system, mailboxes) and mark which ones are the authoritative source for each topic.
- Clean-up: remove duplicates and old versions, or move them to an archive that is not indexed.
- Conversion: turn documents into clean text with headings preserved. Spot-check tables, scans and footnotes, as content is most often lost there.
- Chunking (splitting into searchable sections): split at headings and prefix each section with document title and chapter path so it stands on its own.
- Metadata: store source, version, validity, language, owner and access group with every section.
Checklist: is a document ready for the index?
Use the table as a per-document acceptance check. A “no” in the first three rows is a reason to exclude it.
| Check | Question | Typical problem |
|---|---|---|
| Validity | Is this the current, approved version? | Three versions of the same policy |
| Ownership | Is there a person who corrects errors? | Author has left the company |
| Access | Is it clear who may read it? | Access only via folder rights, undocumented |
| Readability | Is the text complete after conversion? | Scanned PDFs without OCR |
| Self-containment | Is a section understandable without the rest? | “See above”, pronouns without reference |
Solo professionals often start with 20 to 50 of their own templates and need an afternoon, not a project. In enterprises, the inventory is the project; involve business units and information security from the start.
Going deeper: chunking, hybrid search and re-ranking
Section size is a trade-off. Sections that are too small lose context, too large ones dilute search and consume more context. A common starting point is sections of a few hundred words with slight overlap; what decides is testing on your questions. An effective addition is contextual enrichment: before indexing, each section gets one or two sentences explaining where it sits in the document and what it covers. Anthropic has described this approach as “contextual retrieval”.
Hybrid search combines keyword search (such as BM25, a classic method that weights word matches) with semantic search over embeddings (number vectors that represent meaning). Many search services and vector databases support both, such as Elasticsearch, OpenSearch, Azure AI Search, Weaviate or PostgreSQL with pgvector. A downstream re-ranker (a model that re-sorts the top candidates more carefully) often improves result order. Every stage adds latency and cost; add it only if your retrieval test shows an improvement.
Example: an engineering firm indexes its project templates
A fictional 25-person engineering firm has 600 documents on a network drive. The inventory shows: 180 are duplicates or old versions, 40 are scans without OCR, 15 contain HR data and do not belong in a general assistant. Around 365 documents remain.
In the first retrieval test, the question “Which inspection intervals apply to fire dampers?” returns a section containing only “The interval is six months”, with no reference to the component. After prefixing each section with document title and chapter path, the correct hit becomes unambiguous. The inventory took two days, chunking half a day, a rough orientation for similar collections.
Common mistakes
- Indexing everything that is technically reachable. Old versions produce contradictory answers.
- Splitting by fixed character counts instead of content boundaries. Tables and lists get cut mid-sentence.
- Planning to add metadata later. Without version and access group, filters are hard to rebuild cleanly.
- Importing scanned documents unchecked. Faulty OCR produces hits that nobody can read.
Frequently asked questions
Do I need a vector database?
Not necessarily. For small collections, search features of existing platforms or a relational database with a vector extension are enough. Specialised vector databases pay off for large collections with demanding filter and speed requirements.
How often must the index be updated?
As often as the sources change. Automatic re-indexing on document change works well, plus a regular check that deleted documents have also disappeared from the index.
Try it yourself
Take three approved documents. Record the title, relevant section, date, owner and one question answered by each document.
Check your result
For each test question, does search find the correct current passage before any answer is written?