A RAG system needs a reliable way to find useful source text. The hard part is not asking a language model to write an answer. The hard part is preparing documents so the right evidence can be found later.
ChromaDB provides one way to build that search layer. It stores document text, turns that text into embeddings, and indexes the resulting records for similarity search. In this lesson, I will explain the path from a source file to a usable ChromaDB collection.
Start with the source document
A document rarely arrives in a form that can go straight into retrieval. It may be a PDF, a word-processing file, or a scanned page. It may contain headings, tables, footnotes, or several columns.
Text extraction comes first. A parser reads the file and returns text that software can handle. That output still needs review. A parser may place columns in the wrong order. It may drop a table heading or join separate paragraphs.
These errors matter because retrieval can only use the text it receives. If a key exception disappears during extraction, a later answer may sound clear and still be wrong.
Cleaning is the next step. Cleaning can remove unwanted marks, repeated headers, and broken spacing. It can also cause harm if its rules are too broad. A number, symbol, or short phrase may carry the meaning of a policy.
For that reason, document indexing is an evidence task. Each transformation changes what the system can find.
Break the text into chunks
A full document is often too large to store and retrieve as one record. RAG systems usually divide it into smaller pieces called chunks. Each chunk becomes a separate item in the collection.
Chunk size affects retrieval. A very large chunk may contain useful evidence beside many unrelated sentences. A very small chunk may lose the context needed to understand a rule.
Boundaries matter most around connected statements. A policy may state a general rule and then list an exception in the next sentence. If the split separates them, the retriever may return the rule without the exception.
This is why automatic splitting needs inspection. A clean-looking set of chunks can still divide ideas in poor places. Reading several examples often reveals problems faster than debugging a model response.
Add labels that preserve context
Each chunk needs more than its text. It also needs metadata. Metadata is structured information attached to a record, such as a source name, document type, section, or location.
Metadata supports two useful tasks. It can help filter results, and it can help a later system understand where a chunk came from. A retrieved sentence is easier to assess when its source and section remain visible.
A stable identifier is also needed for each record. ChromaDB collections require unique string IDs. These IDs give each chunk a durable place in the index.
The design of these labels should match the questions the collection may receive. If source documents need to be separated by language, date, or policy type, those fields belong in the metadata plan. The exact fields depend on the collection. They should not be added as decoration.
Turn chunks into embeddings
An embedding is a numerical representation of text. It places text with related meaning near other related text in a mathematical space.
This allows semantic search. A query does not need to repeat the exact words in a chunk. It can still find text with a similar meaning, depending on the embedding model.
ChromaDB can create embeddings when documents are added to a collection. It can also accept embeddings created elsewhere. The collection then stores the text, its numerical representation, and any metadata supplied with the record.
That division of work is useful, but it can hide a serious choice. The embedding model affects what counts as similar. A model may handle general English well and perform less well on unusual terms, translated text, or specialized language. An index is therefore shaped by its model, not only by its source files.
Store the collection
A ChromaDB collection is the working unit for storage and search. It holds document records, embeddings, and metadata. It can then return records that are close to a query in embedding space.
A small example makes this clearer. Imagine a fictional policy with two statements:
Staff may borrow equipment for seven days. Extensions are allowed during campus closure.
The text might be split into one chunk or two. If the two sentences stay together, a query about extending a loan during a closure can retrieve the full rule. If the exception is separated, the result may show only the seven-day limit.
The chunk could receive an ID such as policy-01-chunk-01. Its metadata might identify the source as an equipment policy and the section as borrowing rules. ChromaDB can then store the chunk, generate its embedding, and return it for a related query.
The example is small, but the principle scales. Retrieval quality depends on the connection between text, chunk boundary, embedding, and metadata.
Inspect before retrieval
A stored collection is a milestone, not proof of success. The contents still need checking.
Inspection can include reading extracted text, reviewing chunk boundaries, checking metadata, and reconnecting to the saved collection. Reconnection matters because a temporary in-memory collection can disappear when the program ends. Persistent storage allows the index to be opened again for later work.
The checks should focus on evidence. Are headings still attached to the right text? Did a table become unreadable prose? Are exceptions present? Do IDs match the intended records? Does the collection contain the expected number of items?
These questions separate indexing problems from model problems. When a retrieved answer is weak, the cause may be poor chunking or missing text. It may have nothing to do with the language model that writes the final response.
What ChromaDB does and does not solve
ChromaDB can store embeddings, documents, and metadata in searchable collections. It can return records that resemble a query and can support filtering by metadata. This gives a RAG system a practical retrieval layer.
It does not repair a damaged source document. It does not know whether a parser misplaced a column. It does not decide whether a rule and its exception belong in one chunk. Those decisions happen before indexing.
It also does not prove that a retrieved passage is sufficient evidence. A similarity match is a useful lead. It still needs human review in settings where wording, scope, and exceptions matter.
For the Beyond Citation project, this boundary is central. A database index is part of the research method. It is not a substitute for reading the source.
The finished phase leaves an inspectable collection that can be reopened and queried. I can now describe the full path clearly: extract the document, clean it with care, split it into meaningful chunks, attach source metadata, create embeddings, store the records, and inspect the result.
That sequence gives RAG retrieval something solid to work with. It also makes failure easier to locate. The Source List treats that kind of clarity as its promise: one digital source worth knowing, one search tip, and one honest limitation.