# How a search runs

Source: https://grounder.net/docs/routing

> How a question is routed, the two ways a source is reached, every answer a search can give, and what older requests get.

## How a search runs

Grounder sends each question to high-quality sources it chose by hand for that kind of question, and keeps chosen backups. It reaches a source only where none of the source’s disallowed signals refuses it: through the source’s own API, a grounding server whose crawler the site does not refuse, or a licence bought from the publisher for that page. A source’s disallowed signals are its robots.txt rules (its opt-out of search or AI answers included), a licence its robots.txt names, how its CDN answers a crawler, and its pages’ own tags. A search reaches a source [in the way stored for it](https://grounder.net/docs/routing#modes). If the chosen source cannot answer, Grounder uses another source it chose, and when none of them holds the answer it searches the wider web under the same rules. The answer names the sources that answered, and says when the wider web answered. Every search is made in real time: nothing is served from a cache Grounder keeps, so each answer is what the sources return at the moment of the question.

1. The request is checked. Grounder checks your key, free searches or credit, and limits. Nothing in the request or on your account picks how sources are reached.
2. The question is matched to sources. Grounder reads the question against the sources it chose by hand. If none fits, a Grounder provider search goes to the wider web (below).
3. Grounder asks the source in a way none of its disallowed signals refuses. That is the source’s own API, a grounding server whose crawler the site does not refuse, or a licence bought from the publisher. It asks for each source only in that way.
4. Grounder provider returns the answering sources’ results. Results must be on that source’s site or its subdomains, up to 5 in all.
5. The wider web, when no chosen source holds the answer. In Grounder provider, the default, Grounder searches the wider web and keeps only results whose sites’ rules allow it, under the same checks as every other result. The answer’s `note` says the results come from a web search, and its row in `topics` reads `id: "web"`. A Grounder direct search, and a search that names its site, do not go to the wider web.
6. Grounder direct reads the source’s page. Grounder finds the address through a way none of the source’s disallowed signals refuses and then reads the page from its own site. When the site refuses Grounder’s reader, Grounder may buy the page from the publisher under a licence. For feeds, Grounder uses the feed’s answer.
7. The site’s rules are read. Grounder checks the rules that apply to the server that found a result or to Grounder’s hosted reader. See [Sources](https://grounder.net/docs/routing#sources).

The response lists the sources and servers, how Grounder reached each one, and how each call ended. The `server` is a grounding server, or `api` when the source’s own API answered, or `publisher-license` when a page was bought from the publisher.

## How a source is reached

- Grounder provider. The source answers through its own API, a grounding server whose crawler the site does not refuse, or a licence bought from the publisher, and returns the source’s results. Each result carries its source and whether it is licensed.
- Grounder direct. Grounder finds the source’s page and the program on your Mac, or a request naming pages or a site, reads it with your user agent. The default format is Summary, which returns the opening of the page for your model to summarize. [Grounder direct](https://grounder.net/docs/direct) describes the available formats.

Each source is reached one way, chosen ahead of time; there is no field or account setting that changes it. Name pages in `urls`, or a `site`, to have Grounder direct read them. See [which sources Grounder direct reads](https://grounder.net/docs/direct#reads).

## What a search can return

Successful requests return HTTP `200`. The `topics` array has one row for each source the search used and explains what happened for it.

| What happened | What comes back | Counts as a search |
| --- | --- | --- |
| A source answered | `results` and a row with `status: "ok"` | Yes |
| A source returned no usable results | A row with `status: "empty"` | Yes |
| No source Grounder chose held the answer, and the wider web did | `results`, a row with `id: "web"`, and a `note` saying the results come from a web search | Yes |
| Nothing answered, the wider web included | Empty `results` and `topics`, with `no_topic: true`, and a `note` when the best-fitting source does not allow Grounder to reach it | No |
| The step that matches the question did not answer | `503 topic_unavailable` | No |
| The sources that were tried all failed, the wider web included | `503 no_provider_available` | No |

In Grounder direct, a source whose page is read reports `reached: "direct"`. When all of its attempted pages are unread, its row reports `empty` and `direct.pages` gives the reasons. A live feed reports `reached: "feed"`. A source with no Grounder direct way reports `reached: "none"`.

A Grounder direct search is one search, at the one price, even if its page could not be read. No search is charged when no source fits, none of the matched sources supports Grounder direct, the matching step is unavailable, all the sources fail, or the read limit refuses the call with `429`.

A hosted Grounder direct read uses [your user agent](https://grounder.net/docs/direct#user-agent) when you send or save one, and Grounder’s own otherwise. The Mac program can request candidate addresses and read them locally.

## Older requests

Grounder accepts requests from older clients. Fields that no longer affect a search are listed in `ignored`. An older client’s `mode` is listed there too: it chooses nothing.

Pages or a site ask for Grounder direct.

## Saved on your account

Save your page format and user agent under Routing on [your account page](https://grounder.net/account/routing), or read and write them with `GET` and `PUT /v1/search/settings`. A request’s own format takes precedence.

**PUT /v1/search/settings** (JSON)

```json
{ "direct": { "format": "highlights" } }
```

The response gives the effective format and saved user agent under `direct`. Over MCP, `user_info` returns the same in `routing_settings`. Older settings can have a notice about the effective choice or format.

## Sources

Grounder returns only licensed results. A result is licensed when no site’s rules or robots.txt block the server that found it. The site permits that server’s crawler and does not opt out of search or AI answers, or the site’s content is licensed to Grounder. Those, with a licence the robots.txt names, how its CDN answers the crawler and the page’s own tags, are the site’s disallowed signals. The rules are read as the site wrote them. A copy on another host is checked against both sites’ rules.

A result the site does not allow, or whose licence could not be confirmed, is left out, so a search may return fewer results than requested. `provenance.licensed` and `provenance.licensed_basis` give the result’s licensing information. A live feed returns data from its own source.

## Caps

Set a monthly cap under Routing on [your account page](https://grounder.net/account/routing). It is off until you set it. A search past the cap returns `429 cap_reached` until the first day of the month, UTC. The Logs page shows each search, its sources and servers.
