Guide

Searching a large enterprise corpus without losing pages

A practical guide to retrieval over thousands of pages: silent caps, sharding without changing rankings, hybrid search, links as a graph, memory and warm-up.

Updated

Enterprise knowledge isn't small. One team's wiki can run to thousands of pages, and the answer an agent needs is as likely to be on page 4,812 as on page 12. Retrieval that works well on a demo corpus often degrades quietly at this scale, and an agent that can't see the right page doesn't say "I don't know". It answers confidently from the wrong one.

Here's how we think about retrieval over large corpora, and what we recommend to anyone building it.

1. Look for silent caps first

Most retrieval stacks have limits somewhere: a maximum candidate set, a page limit on a listing call, a top-k applied before reranking, a context budget. Each is reasonable alone. Together they can mean a large part of the corpus can never be returned, whatever the query.

Test it directly: pick facts that live only on pages deep in the corpus (by ID, date or listing order) and check they come back. Recall measured on a random sample hides this, because most samples land in the reachable part.

2. Shard, but keep rankings identical

When one index gets too big for one process, shard it. Hash pages across shards, query every shard, and merge. The catch is ranking: BM25 depends on corpus-wide statistics (document frequencies, average length), so naive per-shard scores aren't comparable.

  • Compute term statistics globally, or merge them across shards before scoring.
  • For vector search, take enough candidates from each shard that the global top-k is exact.
  • For hybrid search, fuse after the global merge, not per shard.
  • Prove parity: the same queries should return the same ranked results at 1, 2, 4 and 8 shards. If they don't, sharding has changed your answers, not just your capacity.

3. Use hybrid retrieval, because exact matches matter

Embeddings are good at meaning and bad at specifics: an error code, a SKU, a function name, a clause number. Keyword search (BM25) is the opposite. Enterprise questions need both, so run them together and fuse the results. When users need line-precise answers, keep a path that returns the exact passage, not just the page.

BrainBox Enterprise Search running a hybrid search for "how do auditors verify tokenized logs" over 5,464 Confluence pages; the top result is a crypto-audit tokenization policy with the matching terms highlighted.
Hybrid search over the 5,464-page Confluence project: the top result is the audit-logging policy page, with the matching passage shown.

4. Budget memory, and warm before you switch

Large indexes are mostly a memory problem. Compact posting lists and store vectors at the dimension you actually need; in our experience compaction alone can nearly halve peak memory. Then:

  • Build the index offline and load the finished artifact, rather than embedding on the first query.
  • Warm before cutover: switch a project to a new index only after it's built and loaded.
  • Expect a cold start: the first query on a fresh server pays the load cost. Pre-warm servers that serve large projects.

5. Keep it fresh and deduplicated

Large corpora change constantly and repeat themselves across sources. Re-index incrementally from change events rather than rebuilding, collapse near-duplicate passages so they don't crowd out the top results, and record where and when each passage came from so an agent can tell current guidance from stale copies.

6. Use the links, not just the text

Enterprise pages point at each other: specs link to runbooks, decisions link to the docs they changed. Resolve those links and keep them as a graph. An agent can then follow a reference to the page that actually holds the answer, and a page that many others cite tells you something about how much to trust it.

7. Measure on a real benchmark

Measure on a corpus that looks like production. We use the Confluence portion of EnterpriseRAG-Bench, a public enterprise benchmark: over 5,000 pages, with their links resolved into a connected wiki. We track recall of deep pages separately from overall accuracy.

How BrainBox does it

BrainBox supports hybrid keyword-and-vector search, and sharded indexes that rank exactly like a single index for projects of up to 20,000 pages. Indexes are built offline and warmed before a project switches over. On the Confluence portion of EnterpriseRAG-Bench, questions whose answers sit on pages ranked as deep as 4,552 now return that page as the top result.

Want to see how retrieval holds up on your own corpus? Talk to us.

Give your agents a brain.

Grounded answers, not guesses — from a living model of your business.

Book a Demo