Rachis

How do you prepare documents so search finds the right version?

23 November 2026, updated 28 November 2026

Before making documents searchable, choose their metadata, the information your application stores with each document and passage besides its text. A filter uses that metadata to restrict search to passages that match its conditions, such as the version that applies. Without it, an old version can keep supplying evidence after an update.

You can start with a small set of source, version, date and access fields, then check whether updates and deletions change what search returns.

Keep source information with the text

Attach metadata before dividing documents into passages, then make sure each passage inherits its document's metadata.

Keep a stable document identifier, separate version label, title and source location. Preserve page numbers and positions for citations. Record the document type and the product each document covers, so search can tell, for example, an insurer's policy wording from its claims guidance.

Start with readable extracted text. Before filtering out headers and footers, copy any version label or date they carry into the document's metadata, and keep headings and tables with their text.

Unstructured labels each extracted element with a type, such as Header, Footer, Title or Table. It returns available source metadata, including filenames, file types and PDF page numbers. Keep each element's type and metadata with its text when preparing it for search.

Record when wording applies

A version's effective date is the date from which its wording applies. Record it separately from the dates a file was published or last modified. Where possible, record both when a version starts applying and when it stops.

Take a traveller who bought a policy in June and asks how many days they have to cancel it for a full refund. Their insurer has since replaced the policy wording: the old version allowed 14 days, and the new one, effective from 1 September, allows 21 for policies bought from that date.

With the product, version and effective dates on each passage, a filter on the traveller's product and purchase date keeps only the wording that applies to their policy.

If search can still return passages from both versions, a passage allowing 21 days can reach the request, and the answer can give the traveller 21 days instead of 14.

A 2026 study used synthetic German statute questions that experts validated and filtered provision versions by the date in each question. On a subset, removing that filter caused a substantial drop in accuracy.

Another 2026 study found that outdated documents overturned 30% of Llama's and 37% of Qwen's otherwise correct answers, without instructions to trust them.

When the evidence, question and instructions stayed the same and only the evaluation date changed, dates alone produced only small changes in how the models used the evidence. When the evidence stated when it stopped applying, Llama 70B and Qwen 72B switched almost perfectly between the historical and current answers.

The authors' re-ranker, which ordered documents by relevance and recency, reduced these overturned answers when dates were accurate. Its benefit became small when dates were absent and could reverse when they were wrong.

Restrict search to the documents that apply

In OpenAI's retrieval API, filters select files by their attributes, the metadata stored with each file, before semantic search, which compares numerical representations of text to find passages close in meaning. Its filename filtering examples match a custom filename attribute you must set on each file; they do not automatically match the uploaded file's name.

Azure AI Search can apply a filter before or after this similarity comparison. Filtering afterward can miss matching documents when the filter is highly selective or few results are requested. Microsoft recommends filtering first. Filters apply only to fields marked filterable.

Record each document's access group as well. Azure AI Search describes security filters, which show a user only the documents they are allowed to see, with the requester's security ID passed as the filter criterion. Apply that filter on every search with product, type and date filters.

An index is the structure your application searches to find passages. Changing the source file must also change what that index makes searchable.

Use the stable identifier to find the existing version during an update. LlamaIndex lets you update an indexed document by giving the new version the same document ID. Deleting by that ID removes all of its passages from most index structures; the tree index currently does not support deletion.

Deletion can take time to become visible in search. OpenAI documents that removing files is eventually consistent: search results may still include their content for a short period. Check search results before treating removal as complete.

One RAGFlow user reported Google Drive synchronization runs marked successful that missed new files. A fix was merged, and a collaborator closed the issue as resolved.

Another RAGFlow user reported that syncing Confluence pages with attachments or images produced two files, one under the original attachment name and one under its full path. A merged fix made the identifier always use the full hierarchical path.

A third RAGFlow user reported retrieving deleted PDF passages after repeated deletion and re-uploading. A contributor said this was a known issue when files are deleted while being parsed, and a fix was merged.

One person reported on Hacker News some data loss while importing into Hister, a private search index, because its index was being rebuilt. They pointed to a to-do note in Hister's code saying new documents should be stored in both indexes during a rebuild, so that no data is lost.

The stale answers after updates collection gathers related reports. After a sync, compare the documents in the source with those in the index, and look for one document stored under two names.

A first setup and a check

Start with cleaned text and a consistent set of fields: document identifier, version, source, page, type, product, effective dates and access group. Make each update replace the document's passages by its identifier, and each deletion remove them.

Inspect a few passages to confirm they retain the document's identifier, version, dates and source. Update one document and check that its old passages no longer appear in search. Delete another and check again, allowing for any documented delay.

Run the same question with and without a version or type filter, keeping access restrictions in place. Compare which passages reach the application's request for the model. Keep questions whose answers changed with a new version in your test set, together with their checked answers and source passages.

Join the waitlist: one email when there is something to try.

Read the pain map: Retrieval and citations.