SearchWala

SearchWala Engineering Log: The v7 to v8.3 Rebuild in Rust, Bug by Bug

Published: November 29, 2026 | Author: SandeepCH | Version: v8.3.1 (Apache-2.0) | Repository: SandeepAi369/SearchWala

SearchWala started life as a Rust meta-search server that looked impressive on paper: 35+ search engines, BoringSSL TLS impersonation, reciprocal rank fusion (RRF), BM25+, MMR reranking, and an offline evaluation suite. When we actually measured a live query end to end at commit 6b05c9e (v7.0), almost every layer underneath the ranking stack was silently failing.

This engineering log documents the bugs we measured, the fixes shipped across v8.0 through v8.3.1, the upstream patches contributed back to Rust dependencies, and the resulting single-binary architecture now serving both the local Web UI and native MCP (searchwala mcp).


1. Measuring v7.0 Before Touching Code

Instead of tuning prompts or adding a reranker on top of broken retrieval, we ran a single reproducible query against v7.0 (amar ujala cricket world cup 2027) and logged what actually entered and exited every stage. The full raw audit is archived in the v8.0 Implementation Blueprint.

Stage / Metric Measured in v7.0 (6b05c9e) Root Cause
Engines returning >= 1 result 4 of 35 dispatched wreq BoringSSL client was passed as _stealth_client and never called; 28 engines silently returned 0 results
URLs chosen for scraping Arrival order (not RRF) 85 URLs were RRF-scored, then the first 20 to arrive were scraped; Brave (44) and Yahoo (56) were dropped behind bing_news
Extracted text per chunk 470 chars avg (11,768 chars total) Ordering bug returned 466-byte <meta> descriptions while an 11,716-byte articleBody sat unread in the same HTML (26x loss)
Hindi / Devanagari queries Task panic (connection reset) Byte-slicing UTF-8 strings (&q[..q.len().min(50)], &raw[..300]) split multi-byte characters mid-codepoint
Evaluation harness 474 LOC unused eval.rs and the 50-query golden dataset existed in the repo but were never wired into a binary or CI

Three lessons came out of that audit:

  1. Silent zero-result failures are worse than errors. Engines skipped HTTP status checks, so 202 CAPTCHAs, 403 blocks, and 429 rate limits parsed cleanly into empty Vecs.
  2. Dead code behind pub and _ prefixes hides rot. cargo build did not warn about _stealth_client or unused pub modules.
  3. Downstream ranking cannot fix garbage input. BM25+ and MMR were spending CPU reranking 470-byte meta-descriptions.

2. Fixing Retrieval: Unified Fetcher, BoringSSL, zstd, and Consensus Ranking

Wiring wreq without duplicating every engine

In v7.0, wreq::Client (with BoringSSL Chrome JA4/HTTP2 fingerprint emulation) was constructed per search and ignored. Testing the same blocked queries through wreq turned Brave 429 into 200 (42 .snippet elements) and DuckDuckGo 202 CAPTCHA into 200 (10 primary results + 40 links).

Rather than writing two versions of every engine, v8.0 introduced a single Fetcher enum (src/fetcher.rs) unifying Fetcher::Plain(reqwest::Client) for independent/open engines and Fetcher::Stealth(wreq::Client) for WAF-protected engines, reusing a shared client across searches and enforcing HTTP status validation on every fetch.

The missing zstd feature bug

During v8.0 P0 triage we hit another silent bug: the HTTP client advertised zstd in Accept-Encoding, but reqwest did not have its zstd Cargo feature enabled. Servers responded with compressed zstd frames that arrived as undecodable raw bytes and failed HTML parsing silently. Enabling zstd in Cargo.toml immediately recovered affected responses.

Pruning 28 dead engines to 19 live engines with index-family voting

Dead domains (alexandria, excite, lycos, mullvad_leta, pipilika, searchencrypt) and broken endpoints were removed rather than kept for marketing numbers. SearchWala now dispatches up to 19 live engines across web, news, and scholarly sources (including OpenAlex and arXiv), with index-family consensus ranking:


3. Fixing Extraction: 10x to 37x More Content per Page

Replacing the v7.0 ad-hoc extractor in Phase 3 (d3a713f) and promoting dom_smoothie in v8.2 (733904e) turned 470-character boilerplate snippets into clean full-article Markdown:

Upstreaming fixes to the Rust ecosystem

Real-world web scraping exposed edge cases inside upstream Rust crates that we fixed and submitted back upstream instead of keeping private forks:


4. Ranking, UTF-8 Safety, and the Offline Eval Harness

With live retrieval and clean extraction restored, we fixed the pipeline plumbing that had been throwing away computed signals:


5. v8.1 to v8.3.1: Local SQLite Chats, Native MCP, and Security Hardening

Zero-dependency MCP server in the same Rust binary (80deb86)

In v8.3.0, we added a native Model Context Protocol (MCP) server directly into the searchwala binary so coding agents (Claude Code, Cursor, VS Code, Gemini CLI, Codex) can use SearchWala with zero search API keys and zero LLM API keys:

Security, packaging, and single-binary footprint (d7b2039, f0dd4b9, 0c7e8a2)


6. Snapshot: v7.0 vs v8.3.1

Metric v7.0 (6b05c9e) v8.3.1 (a5702ab)
Live working engines 4 / 35 dispatched Up to 19 live engines, index-family consensus
Stealth TLS (wreq BoringSSL) Built, unused (_stealth_client) Wired via unified Fetcher enum
Extraction quality 470 chars/chunk avg (26x loss) Full Markdown, tables, LaTeX (dom_smoothie + rs-trafilatura)
Runtime memory (RSS) Unbounded leaks / duplicate clients ~30 to 80 MB single static-like Rust binary
Local persistence In-memory only Local SQLite (~/.searchwala/searchwala.db), O(1) history
Agent integration HTTP only Native stdio + Streamable HTTP MCP server (searchwala mcp)
Automated verification Unwired eval, dead code 360 tests, real SERP fixtures, 50/50 intent gate, -D warnings

Further Reading