metasearch-rs
A SearXNG-style metadata search engine written in Rust. Fans out queries to multiple search engines concurrently, scrapes their HTML results, deduplicates by normalized URL, and ranks using Reciprocal Rank Fusion (RRF). Also supports image search through a dedicated /images endpoint.
How it works
- A search request arrives at
GET /search?q=<query> - The query is sent concurrently to DuckDuckGo, Brave, Startpage, and Yahoo via
reqwest - Each engine parses the HTML response with
scraper(CSS selectors over Mozilla's html5ever) - Results are deduplicated by normalized URL (tracking params stripped, locale prefixes removed, query params sorted)
- Duplicate URLs are merged and scored with RRF (
score = Σ 1/(60 + rank)across engines) — pages returned by multiple engines rank higher - The top results are returned as JSON
Image search follows the same pipeline on GET /images?q=<query>: the query is fanned out to image engines (currently Bing Images via its /images/async endpoint and Google Images via its internal async=_fmt:json API), results carry the hosting page URL, the full image URL and a thumbnail preview, and are deduplicated by normalized page URL + image URL before RRF ranking.
Requirements
- Rust 1.75+
- Cargo
Installation
As a library
Or add manually to Cargo.toml:
[]
= "0.1"
As a server (from source)
Running
PORT=8080 MAX_RESULTS=20
Enable debug logging:
RUST_LOG=debug
Examples
Add to your Cargo.toml:
[]
= "0.1"
= { = "1", = ["full"] }
Query a single engine
use Arc;
use ;
async
Fan out to all engines and get RRF-ranked results
use Arc;
use ;
async
Use only specific engines
use Arc;
use ;
async
API
GET /health
GET /search?q=<query>
Error responses:
| Case | Status | Body |
|---|---|---|
Missing q |
400 | {"error": "invalid query parameters"} |
Empty q |
400 | {"error": "query parameter 'q' cannot be empty"} |
| All engines fail | 503 | {"error": "all engines failed to respond"} |
GET /images?q=<query>
url is the page hosting the image, img_src is the full-resolution image file, and thumbnail_src is a smaller preview. Image results are deduplicated by normalized hosting page URL + img_src, mirroring SearXNG's template|url|img_src image result hash.
Error responses: same semantics as /search, plus 503 {"error": "no image engines configured"} when no image engines are wired in.
Tests
# All unit tests
# Specific module
# Live tests (hit real search engines — requires internet)
Live tests are marked #[ignore] so they don't run in CI by default. Run them manually to verify HTML selectors still work against the real sites.
Terminal UI
A ratatui-based TUI is available as a crate to install here. Access the code via github

Adding a new search engine
- Create
src/engines/<name>.rs - Define a struct holding
Arc<reqwest::Client> - Implement the
SearchEnginetrait:
Add it to engines/mod.rs and wire it in main.rs. Give the struct a
timeout: Duration field and a new()/with_timeout() constructor pair like
the built-in engines, and pass the timeout into the module's search function.