How search works
EdgeFetch’s search tool and POST /v1/search fan a query out to the search providers your hub has keys for, merge
the results, optionally rerank them, and return snippets with their sources. Everything except the network calls
lives in Go (internal/websearch), so the Cloudflare hub and the self-hosted Go hub behave the same.
Providers are YAML manifests
Section titled “Providers are YAML manifests”Each provider is one file in
internal/websearch/providers/:
endpoint, request template, where the results are in the reply, list price per call, and capabilities (domain filter,
time filter, how fresh its index is). Today: Serper (Google), Brave, Tavily, SearXNG, Ceramic and Cloudflare Web
Search. Adding an HTTP provider is a YAML file; the hub only attaches the key named in the manifest and sends the
request.
How a search runs
Section titled “How a search runs”- Plan. The query gets a class: news, docs, academic, reference or general (rule-based; a time range always means news). Direct search calls Serper and Brave in parallel; internal callers use a waterfall that asks the next provider only while results are thin. Tavily is the paid fallback when results stay thin. News queries call the freshest providers first and skip stale-index engines.
- Health and budgets. A provider that fails five times in a row (errors, empty or very slow answers) is skipped
for 60 seconds, then tried once. A request can set
budgetUsdandtimeoutMs; an operator can cap each provider’s monthly spend withSEARCH_BUDGET_<PROVIDER>_USD_MONTH. - Fusion. Reciprocal-rank fusion (k = 60). Each source counts once per result, at its best rank. Results are merged
on a normalized URL (host case,
www., default ports, dot segments, percent-encoding, tracking parameters). At most two results per site lead the list.detail: "full"shows each result’s per-source score breakdown. - Rerank (optional). A cross-encoder through OpenRouter scores the top 25 and is blended 70/30 with the fused order. Any failure keeps the fused order.
- Cache. Each provider’s results are cached on their own, keyed by the normalized query, for 1 hour (news),
24 hours (most queries) or 7 days (reference questions).
noCacheandcacheTtloverride it per request.
Every response carries a trace: cache outcome, then each provider with a stable status code, time, hit count and
list-price cost. Provider error text never reaches callers. Operators can read spend per provider per day at
GET /v1/search/spend.
Measured accuracy
Section titled “Measured accuracy”On a 100-question public search benchmark (OpenBenchmarks company-news split), graded blind, with one run per arm on the same deployment:
| Arm | Answer in top result (AR@1) | Answer in top 5 (AR@5) | Median latency |
|---|---|---|---|
| No rerank | 88% | 100% | 1.73 s |
Cohere rerank-5-fast |
96% | 100% | 2.11 s |
Voyage rerank-2.5 |
92% | 100% | 1.96 s |
With Cohere reranking, three results already contain the answer for 99% of questions. Between runs on the live web, the
no-rerank arm changed whether its top result held the answer on 16 questions, while Cohere changed on 4. Reranking costs
about $0.05 per 1,000 searches at list price. Per-question verdicts for each arm are published in
bench/compare/search/published.
Compared with open-source search gateways
Section titled “Compared with open-source search gateways”What each project does, from its source code as read in November 2026. EdgeFetch borrowed several of these ideas; the right column says what it adds.
| Project | What it does | What EdgeFetch adds |
|---|---|---|
| Argus | RRF fusion, site diversity, provider circuit breakers | Shared persistent cache across callers, cross-encoder rerank with measured accuracy |
| web-search-plus-mcp | Provider health and budgets, a rule-based query classifier, compact and full detail levels | Providers defined as data, per-provider cache lifetimes by query class |
| mcp-omnisearch | Many providers behind one MCP server, compact tool schemas | Page extraction with 491 site adapters, robots.txt-checked fetching of results |
| mcp-searxng | SearXNG replicas with failover, HTML fallback | The same, plus fusion with paid providers and reranking |
| mcp-search-hub | Routing and budgets across providers | One Go implementation shared by the Cloudflare and self-hosted hubs, per-search telemetry and spend reporting |
Not adopted on purpose:
- A semantic cache. Reusing the results of a “similar” query risks answering a different question.
- Model-written code at request time. Running code an LLM wrote while serving a search request adds risk for no gain in retrieval quality.
