An identifier semantic search can't find

This one is the search itself, and it's the only failure which the language model plays no part in.

"I typed the reference number that's printed in our document. It came back with something else entirely."

A real example

The code 2008 LC18 appears in these documents. Here's what the search returned asked for:

What is 2008 LC18?

NOT IN CONTEXT

The passage holding it came 139th out of 2,948.

A question with more detail

Ask for the same code again, but provide a clue about the code:

What is 2008 LC18?

139th

What is the Neptune trojan 2008 LC18?

1st

It can find the code once you tell it what the code is. However, the problem is that if you could describe the thing, you wouldn't be looking up its number.

Semantic search works by meaning, not by matching letters. It turns your question into a position in a space of meanings and finds passages that sit nearby. 2008 LC18 means nothing, so it lands nowhere in particular.

So use keyword search instead?

Plain keyword search finds every one of the 4 codes at or near the top. The keyword search algorithm used here is BM25, the standard keyword ranking behind most search engines and most RAG systems. Then you ask it something in your own words:

What is the enormous swirling weather system on Jupiter called?

the passage that answers it came 872nd

Keyword search matches the words you typed. Ask a question that happens to use none of the words the document used, and it has nothing to go on. Each method fails in it's own way.

Find a setting that answers all 7

All 7 searched against the same 2,948 passages: 4 exact codes, and 3 questions asked in your own words. Two controls: how much of the vote each search gets, and how many results are kept and passed on. One combination answers all 7.

Why does this happen?

The two searches are built on opposite assumptions, and each one's strength is exactly the other's weakness.

Semantic search

Good: finds the answer when you phrase the question your own way.

Bad: a code has no meaning, so there's nothing for it to be near.

Keyword search

Good: a rare string of characters is the easiest thing in the world to match exactly.

Bad: change the words and it has nothing to match.

Full written explanation
Symptom
"I typed the reference number that's printed in our document. It came back with something else entirely."
What's happening
Semantic search represents a passage by what it's about. An identifier isn't about anything, so a query that's only an identifier lands nowhere near the passage carrying it. The passage is in the index, correctly, and ranks 139th of 2,948.
The check
Ask the same question twice: once as the bare code, once with a few words saying what sort of thing it is. If the second works and the first doesn't, the index is fine and the query has no meaning to match on. No change to the model or the prompt will affect either result.
The fix, and its cost
Add BM25 keyword search alongside the vector index, combine the two rankings, and keep a wider pool of results than you intend to use, re-sorting it with a reranker. Combining is what rescues the codes; the wider pool is what stops the combination burying everything else. Both cost latency, and the reranker is a second model to run and pay for. Routing by query shape avoids all of that, at the price of a rule that has to be maintained and will mishandle mixed queries.
What doesn't work
A better embedding model, which is still representing meaning for something that has none. Nor a longer context or a better prompt: the passage never reaches the model, so nothing downstream of retrieval can help.

Measured over 2,948 passages, chunked at 900 characters with 150 overlap. Keyword ranking is BM25Okapi; the two rankings are combined with reciprocal rank fusion, constant 60. The 3 questions asked in your own words are facts this model already knows, so for those the evidence is where the passage ranked, not whether the answer came back right.