v0.2.0 Rust · actix-web 4 GPL-3.0

Turn search results into an answer-engine chunk map.

Polymathy is a small Rust service that sits in front of a SearxNG instance, pulls the top result URLs, and hands them to a content processor for chunking and embedding. It returns chunk_id → (source_url, text) over plain HTTP — the back of an answer engine, not the front.

$ cargo add polymathy  ·  crates.io/crates/polymathy

GET /v1/search
GET /v1/search?q=rust+async+patterns

200 OK · application/json
{
  "0": ["https://blog.rust-lang.org/…",
        "Async functions return a Future…"],
  "1": ["https://tokio.rs/…",
        "Tokio provides an async runtime…"],
  "2": ["https://docs.rs/…",
        "When working with async Rust…"]
}

What is Polymathy

The fetch-and-chunk seam of an answer engine.

Most teams building answer experiences over web or internal content write the same boring middleware: take a query, get URLs, fetch them, chunk them, return the chunks. Polymathy is exactly that middleware — a single Rust service with an OpenAPI spec — and nothing more.

It is infrastructure for building answer engines, not a turnkey RAG product. You keep ownership of the SearxNG instance, the chunker, the embedding model, and the LLM that turns chunks into a cited paragraph.

See the four-step request flow →

WHAT IT ISN'T

  • No embedding model bundled — the processor handles that
  • No LLM call — Polymathy returns chunks, you cite
  • No persistent index — USearch is per-request in v0.2
  • No auth or rate limiting — that's your reverse proxy

Problem → solution

Ten blue links

A metasearch engine returns ranked URLs. To answer a question you still have to fetch each page, strip the boilerplate, chunk the text, embed it, and keep track of which chunk came from which URL — per query, in the hot path.

One cited chunk map

Polymathy does the fetch-chunk-embed dance for you and returns a map keyed by u64 chunk id, each value a (source_url, text) pair. Your LLM stuffs the text; your UI renders the citation. The source never gets lost.

Features

A narrow surface, precisely shaped.

One endpoint, one job

GET /v1/search?q=… is the whole public surface. No sprawl, no admin console — just the fetch-and-chunk seam an answer engine needs.

Citations by construction

Every chunk carries its source_url in the response shape. The chunk_id → (source_url, text) map makes attribution a data invariant, not a prompt convention.

SearxNG in front

Point at any SearxNG instance via SEARXNG_URL. Polymathy reads its top result URLs — it does not run a crawler or index of its own.

Pluggable processor

Chunking and embedding are delegated to your PROCESSOR_URL service. Swap the chunker or the embedding model without touching Polymathy.

OpenAPI from the types

apistos generates the spec straight from the Rust types. Swagger, ReDoc, RapiDoc, and Scalar UIs ship in the binary.

Boring Rust, single binary

actix-web 4, tokio, reqwest, usearch. One crate, one binary — you supply SearxNG and the processor, nothing else to operate.

All features →

Code showcase

The whole service is one request.

GET /v1/search?q={query} hits your SEARXNG_URL, takes the first ten result URLs, and fans them out to your PROCESSOR_URL in parallel. The processor returns chunks and 384-dim embeddings; Polymathy assigns sequential u64 chunk IDs and returns the JSON map.

Everything is generated from Rust types. The OpenAPI spec, Swagger, ReDoc, RapiDoc, and Scalar UIs come for free via apistos.

Run it in five minutes →

# configure the two upstreams
export SEARXNG_URL=https://searx.example.org
export PROCESSOR_URL=https://processor.internal

# run the service
polymathy serve --port 8080

# ask a question
curl 'http://localhost:8080/v1/search?q=how+does+tokio+schedule+tasks'
# -> { "0": ["https://…", "Tokio's scheduler…"], … }

How it works

Query in, cited chunk map out.

Four steps, no persistence, no hidden state — the whole request handler on one line.

Query/v1/search?q=…
SearxNGtop 10 URLs
Processorchunk + embed
Chunk mapid → (url, text)

Read the architecture →

Honest numbers

1
public read endpoint
10
URLs fetched per query
384
embedding dimensions
4
API doc UIs bundled

No throughput or latency claims — those depend entirely on your SearxNG instance and processor.

Read the whole service end to end.

Polymathy is a single GPL-3.0 crate. No lock-in, no SaaS, no hidden index — just the seam between metasearch and your prompt.