Skip to content
unlob

Search one project's documentation

Use site= with vertical=code and content_type[]=docs to restrict a search to one project’s documentation instead of filtering the results afterwards.

The problem

The instinct is to put the domain in the query string — "tokio docs.rs async" — and hope ranking does the rest. It usually will not: the domain becomes ordinary query terms competing with the real ones, so you get pages *about* docs.rs alongside pages *on* it, and the results are quietly worse for a reason that is hard to see.

What to send

site

docs.rs

A hard restriction to one host. Not a hint, not a boost.

vertical

code

Disambiguates by construction — "rust" cannot return metallurgy from the code vertical.

content_type[]

docs

Excludes blog posts and forum threads on the same host.

  1. Unfiltered query128 hits
  2. Scoped to the code verticalvertical=code47 hits
  3. Restricted to one hostsite=docs.rs19 hits
  4. Documentation onlycontent_type[]=docs11 hits
Filters are evaluated before scoring, so a heavily filtered query is frequently faster than an unfiltered one — not slower, which is the intuition most people bring.

The code

curlbash
curl -H "x-api-key: ulb_..." \
  "https://api.unlob.com/search?q=async+runtime&site=docs.rs&vertical=code&content_type[]=docs&limit=10"
Pythonpython
import httpx

r = httpx.get(
    "https://api.unlob.com/search",
    headers={"x-api-key": "ulb_..."},
    params={
        "q": "async runtime",
        "site": "docs.rs",
        "vertical": "code",
        "content_type[]": "docs",
        "limit": 10,
    },
)
for hit in r.json()["results"]:
    print(hit["score"], hit["url"])

The mistake to avoid

Putting the domain in `q` instead of `site`. It looks like it works — you get plausible results — which is exactly what makes it expensive to discover. Filters are evaluated before scoring; query terms compete with your real ones.

Frequently asked questions

Can I search several sites at once?

`site` takes one host. For a small set, run one call per host and merge — they are independent and can go in parallel. To go the other way and remove hosts, `exclude_site[]` accepts several.

Does site include subdomains?

It matches the host as indexed. If a project splits documentation across `docs.example.com` and `example.com/docs`, that is two calls or one `tld`-scoped query, not one `site` value.

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.