From 147b3b1507ebcdf5912fbd4c474c9dfb35265148 Mon Sep 17 00:00:00 2001 From: Igor Soarez Date: Fri, 6 Nov 2026 03:18:21 +0000 Subject: castle-search: read Brave again, and report genuine zero-hit searches as such Brave: #results no longer exists on the live page; fall back to #main/main. It was reported as 'no results area at all', i.e. a rate limit. DuckDuckGo: its 'No results found' notice is itself a .result, so an empty search looked like broken markup. emptyMarker lets the probe say the engine itself reported no matches, and the error tells the caller to loosen the query instead of switching engines. --- castle-search/src/search.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'castle-search/src/search.ts') diff --git a/castle-search/src/search.ts b/castle-search/src/search.ts index 1c84392..c64735d 100644 --- a/castle-search/src/search.ts +++ b/castle-search/src/search.ts @@ -299,6 +299,18 @@ export const search = async ( }); } + if (probe.results.length === 0 && probe.empty) { + // The engine itself says nothing matched. That is the query's doing, not + // the extractor's or a rate limit's, and saying so stops the caller from + // switching engines for a query no index will answer. + throw new NoResultsError( + `${engine.label} reports no matches for this query (${probe.url || searchUrl}). The page loaded ` + + `normally and the engine says so itself, so this is not a block or a broken extractor — the query ` + + `is too narrow. Drop the quotes or some of the terms; retrying another engine with the same ` + + `over-specific query is unlikely to help.`, + ); + } + if (probe.results.length === 0) { // "container missing entirely" and "container present but empty" are // different faults, and saying which saves the next person a browser -- cgit v1.2.3