Skip to content
unlob

Search modes

Three retrieval strategies with genuinely different failure modes. Picking deliberately is worth more than any amount of query tuning.

keyword

BM25 over the lexical tier. Fastest of the three at a measured 2.1 ms median, and correct whenever the query contains terms that must literally appear — identifiers, error codes, product names, quoted phrases.

Its failure mode is vocabulary mismatch: if the user says "car" and the document says "automobile", keyword mode finds nothing. For high-volume agent traffic with well-formed queries, it is often the right default anyway, because it roughly halves latency.

semantic

Nearest-neighbour search over the vector tier, with a rerank pass. Right when the user's words and the document's words differ, and the only mode that works across languages — the embedding space holds 101 languages at once, so an English query can retrieve a German passage directly.

Its failure mode is exactly the opposite: identifiers have no useful neighbourhood in embedding space, so a semantic search for an error code returns things that are merely about errors.

hybrid

Runs both and fuses the two rankings by reciprocal rank. It is the default because it is rarely wrong — a result strong in either space surfaces, and the fusion does not require tuning a weight between two incomparable score scales.

The cost is latency: a measured 4.6 ms median against 2.1 ms for keyword. For most workloads that is irrelevant; for very high volume it is worth measuring whether keyword alone is sufficient.

Choosing

Use keyword when the query contains something that must literally match, or when you are optimising for throughput. Use semantic for natural-language questions and cross-language retrieval. Use hybrid — the default — when the query shape is unpredictable, which is most agent traffic.

A useful pattern: run hybrid, and pass term alongside it when the query contains an identifier. You get semantic recall with a hard lexical guarantee.

bashbash
# Identifier present: pin it, but keep semantic recall
curl -H "x-api-key: $UNLOB_API_KEY" \
  "https://api.unlob.com/search?q=connection+pool+exhausted&term=SQLSTATE-08006&mode=hybrid"

Frequently asked questions

Which mode is cheapest?

They bill identically — a request is a request. Keyword is cheapest in latency, not in price.

Does semantic mode work across languages?

Yes. All 101 supported languages occupy a single embedding space, so a query in one language retrieves relevant passages in another with no translation step. Use the lang filter when you need to pin the output language.

Start on the free tier

10,000 requests a month, no card. Everything documented here works on every plan.