Use case
Documentation search for coding agents
Teams building coding assistants and developer tooling.
The problem, and the approach
The problem
- A general web search for a programming question returns tutorial blogs that paraphrase documentation, frequently against an older version.
- Semantic search actively harms error-code lookup: an exact identifier has no meaningful embedding neighbourhood, so results are merely about errors.
- Ambiguous names cross domains — a query for "rust" returns metallurgy alongside the language.
The approach
- vertical=code is disambiguation by construction: metallurgy passages are not in that core, so they cannot be returned regardless of ranking.
- content_type=docs restricts to reference material maintained by whoever built the thing, rather than blogs about it.
- The term filter is a hard lexical requirement, and it is backed by a guarantee: an error code that is in the index stays findable, however aggressively the corpus is compacted.
The parameters that matter
| Parameter | Value | Why |
|---|---|---|
vertical | code | Ambiguous names cannot cross into other domains. |
content_type[] | docs | Official reference rather than paraphrase. |
term | the error code | A hard lexical requirement semantic search would smooth away. |
site | docs.example.com | Turns the index into search over one project’s documentation. |
# Documentation only, no tutorial blogs
curl -H "x-api-key: $UNLOB_API_KEY" \
"https://api.unlob.com/search?q=async+runtime&vertical=code&content_type[]=docs&limit=8"
# Exact error code
curl -H "x-api-key: $UNLOB_API_KEY" \
"https://api.unlob.com/search?q=connection+pool&term=SQLSTATE-08006"The blogspam problem is a content-type problem
Ask a general web index about a library API and a large share of what comes back is tutorial content paraphrasing documentation — often against a version two releases old, and frequently with the error that the reader was trying to resolve. It ranks well because it is written to rank; it is bad input for a coding assistant because it is confidently specific and wrong.
Restricting to documentation is not a relevance tweak, it is a change of corpus. Documentation pages are structured, versioned and written to be correct rather than to be found, which makes them unusually reliable per token — and because the content type is assigned from page structure at index time rather than guessed from the URL, the restriction holds on documentation hosted somewhere unexpected.
Identifiers are where semantic retrieval fails
An error code, a CVE, a panic message or a build flag has no useful neighbourhood in embedding space. Semantic retrieval will return things that are about the same subject, which is exactly the wrong behaviour when the user pasted the literal string and needs the page that contains it. This is the single most common bad result in a coding assistant, and it is not a ranking problem.
A hard lexical requirement layered over the semantic query fixes it: the meaning of the question still drives retrieval, but the identifier must actually appear. Pair it with a recency preference when the version matters, and be aware of the boundary — the index does not model library versions explicitly, so a question that is really about a version difference needs the version in the query or the date bound doing that work.
Where this is not the right tool
- Documentation for very new or niche libraries may not be indexed. why_not distinguishes not-crawled from removed.
- The index does not track versions explicitly. Use published_from when a recent version matters.
Frequently asked questions
How do I search one project’s documentation?
Set site to its documentation host and content_type to docs. That turns a general index into project-scoped documentation search with no separate integration.
Why use term instead of quoting the phrase?
A quoted phrase constrains the query; term is a hard filter on the index. It is also backed by our guarantee that an exact identifier in the index stays findable rather than being compacted away.
Build it on the free tier
10,000 credits a month, no card. Every parameter above works on every plan.