All posts
Engineering6 min read

We spent a week trying to break our own search engine

A benchmark you always pass tells you nothing. So we built corpora designed to embarrass ours — at scale, full of near-duplicates, with questions that have no answer — and rebuilt the ranker around what we found.

Our first retrieval benchmark ran a few dozen queries against the small sample wiki that ships with the engine, and it scored near-perfect. We were pleased for about a day — until the obvious problem surfaced: a test you cannot fail cannot tell you whether a change helped. There is no room left to measure in.

So we stopped trying to pass our own test and started building corpora designed to fail it.

Three ways to make retrieval hard

Scale: tens of thousands of documents, with plausible-but-wrong distractors deliberately competing with the right answer — a corpus of unrelated filler re-saturates a benchmark immediately. Confusion: near-identical pairs, a superseded ADR beside the one that replaced it, a deprecated runbook beside the live one, where returning the stale twin is scored as a miss and not a near-hit. Absence: for some questions we removed the answer from the corpus entirely, so anything returned counts against us. That last one is the failure that actually bites teams — not “the answer isn’t there,” but “there are two answers and one is nine months out of date.”

The biggest lever was the documents, not the model

The clearest result of the week: on identical content at identical scale, how a document is written moved quality more than any change we could make to the engine. Structured documents — one clear title, one topic, real section headings — put a correct source in the top ten on 99% of queries at up to ten thousand documents, in about thirty milliseconds, measured on our benchmark suite. The same content flattened into untitled prose scored far lower. That gap is the most useful thing we learned all week, and it is mostly in your hands, not ours.

What rigor actually looked like

Most of the week was spent rejecting good ideas. The textbook fix for weak ranking is a heavier reranking model; we built one, measured it, found it markedly slower and no more accurate on the hard corpus, and shipped it off by default with the disappointing number recorded next to the code. We would rather keep a measured failure in the repository than quietly drop it and let someone repeat it in six months.

We also caught signals that had silently stopped working — the kind of bug that passes every unit test because the test never exercises the real pipeline — and fixed them by measuring end to end against a real index instead of a mock. And we taught the ranker to read what authors already write: a document that declares itself superseded should stop outranking the one that replaced it. Consuming that declared status cut stale-first results from 54% to 8% on the confusable corpus — without guessing, because the engine demotes only what the author actually wrote. Inferring staleness from age would break a working corpus to fix a broken one.

What is still hard

  • The engine does not yet abstain. On questions whose answers we had deleted, it still returned confident-looking results. A result existing is not evidence that an answer exists — the top result is a suggestion, not a verdict.
  • Ranking, not reach, is the frontier: the right document is usually retrieved and then lost in selection, which is a harder and more interesting problem than simply retrieving more.
  • Multi-hop questions — where the answer needs two documents joined — remain the weakest class. Two simple queries beat one clever one.

So we wrote a usage contract

The honest conclusion of a week of measurement is that a caller who knows how the engine fails gets far more out of it than one who trusts it blindly. So the deliverable was not only patches — it was a contract for how to call it.

  1. 01Search wide, read narrow. Fetching full pages is the expensive step; use breadth in search so you are not guessing which page to open.
  2. 02Use k of 3–5 for an exact identifier, 10 by default, 20–25 when the query is vague. Past that, reformulate — the engine is selection-limited, not reach-limited.
  3. 03Read several snippets before concluding anything. Never conclude from the first result alone.
  4. 04Check a document’s declared status before citing it, and follow its supersession pointer. The ranker demotes what documents declare; it has no notion of authority on its own.
  5. 05If no snippet states the fact, reformulate once, widen once, then report absence — with the closest paths. That is a correct answer.

The open-source engine and its benchmark harness are public: point it at your own corpus and measure it yourself. A retrieval engine whose quality you cannot check is asking for a kind of trust this category has not earned yet.