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/test/extraction-config.test.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 castle-search/test/extraction-config.test.ts (limited to 'castle-search/test') diff --git a/castle-search/test/extraction-config.test.ts b/castle-search/test/extraction-config.test.ts new file mode 100644 index 0000000..43d2108 --- /dev/null +++ b/castle-search/test/extraction-config.test.ts @@ -0,0 +1,16 @@ +import assert from "node:assert/strict"; +import { test } from "node:test"; + +import { getEngine } from "../src/engines.ts"; + +test("duckduckgo can tell a genuine zero-hit page from broken markup", () => { + // Its "no results" notice is itself a `.result`, so without a marker an empty + // search looks like an extractor failure. + assert.equal(getEngine("duckduckgo").extraction.emptyMarker, ".no-results"); +}); + +test("brave falls back to main when #results is absent", () => { + const roots = getEngine("brave").extraction.roots; + assert.ok(roots.includes("main")); + assert.equal(roots[0], "#results"); +}); -- cgit v1.2.3