Skip to content
unlob

Find an exact error code or identifier

Use term= with mode=keyword to require an exact token, instead of letting semantic search return documents that are merely about the same subject.

The problem

Semantic search is actively wrong for identifiers. `ENOSPC` has no meaningful neighbourhood in embedding space, so a semantic query returns articles about disk errors in general — plausible, adjacent, and not the one page that names your code.

What to send

term

ENOSPC

A hard lexical requirement. The document must carry this token.

mode

keyword

BM25 only. Skips the vector path entirely rather than blending it in.

The code

curlbash
curl -H "x-api-key: ulb_..." \
  "https://api.unlob.com/search?q=disk+full+write+failure&term=ENOSPC&mode=keyword"
JavaScriptjavascript
const params = new URLSearchParams({
  q: "docker build fails no space",
  term: "ENOSPC",     // hard requirement, not a hint
  mode: "keyword",    // don't let vectors smooth the identifier away
  limit: "5",
});

const res = await fetch(`https://api.unlob.com/search?${params}`, {
  headers: { "x-api-key": "ulb_..." },
});
const { results } = await res.json();

The mistake to avoid

Leaving `mode` on the default `hybrid` and hoping the quoted identifier survives. Hybrid blends a semantic score in, so a page that is *about* your error can outrank the page that *contains* it. For identifiers, say `mode=keyword` and mean it.

Frequently asked questions

How is term different from quoting the phrase in q?

A quoted phrase constrains the query and still competes with everything else in it. `term` is a hard filter applied before scoring — a document without that token is not a candidate at all.

Will an obscure identifier still be in a bounded index?

Yes, and that is a guarantee rather than a hope: an exact identifier that is in the index stays findable and is not compacted away. If a code genuinely was never indexed, `why_not` will say so rather than leaving you guessing.

Try it against your own queries

10,000 requests a month on the free tier, no card. Enough to run a real evaluation set rather than a demo.