Search Architecture
Overview
The search system provides multi-provider web search with automatic fallback, geo-location support, and intelligent query processing. It prioritizes speed while ensuring results through a cascade of search providers.
Provider Cascade (Priority Order)
Query Input
↓
┌─────────────────────────────────────────────────────────────┐
│ 1. SerpAPI (2s timeout, 2 retries) │
│ └── Fast, reliable, no rate limits │
│ ↓ If fails/empty │
├─────────────────────────────────────────────────────────────┤
│ 2. Google Custom Search (2s timeout, 2 retries) │
│ └── Standard Google results │
│ └── Redis-based key rotation (9900 req/day/key) │
│ ↓ If fails/empty │
├─────────────────────────────────────────────────────────────┤
│ 3. Google + Retext Keywords (2s timeout, 2 retries) │
│ └── Extracts key terms from query for better results │
│ ↓ If fails/empty │
├─────────────────────────────────────────────────────────────┤
│ 4. SerpAPI Slow Mode (5s timeout, 5 retries) │
│ └── Last resort with extended timeout │
└─────────────────────────────────────────────────────────────┘
↓
TOrganicResult[] (normalized format)