searcher: skip empty-result instances in failover

Treat an instance that answers 200 with zero results as a soft failure and
fall through to the next instance, instead of short-circuiting on it. This
makes public SearXNG backups actually take over when the primary instance is
up but its upstream engines are rate-limited (200-but-empty). Only return []
when every responding instance is empty; still raise SearchError only when
every instance hard-fails (unreachable/non-200/non-JSON).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
User 2026-07-07 17:04:43 -07:00
parent ae56657d94
commit 0a80d0ef26
2 changed files with 27 additions and 4 deletions

View file

@ -1,5 +1,11 @@
# SearXNG instance pool. MVP: one local instance; add more entries later for
# rotation/fan-out (the searcher already reads the whole list for failover).
# SearXNG instance pool. The searcher tries these in order and uses the first
# one that returns a NON-EMPTY result set; an instance that answers 200-but-empty
# (its upstream engines are rate-limited) is skipped in favor of the next. It
# raises only when every instance hard-fails (unreachable / non-200 / non-JSON).
#
# Keep the internal instance you control FIRST, then add public backups below.
# Public searx.space instances must have the JSON format ENABLED or they get
# skipped as a hard failure (they return HTML, which fails JSON parsing).
instances:
- name: local
url: http://searxng:8080