diff options
| author | Igor Soarez <igor@soarez.org> | 2026-11-06 03:18:21 +0000 |
|---|---|---|
| committer | Igor Soarez <igor@soarez.org> | 2026-11-06 03:18:21 +0000 |
| commit | 147b3b1507ebcdf5912fbd4c474c9dfb35265148 (patch) | |
| tree | 804ab62ee7266e450482e00d40a5c9c467a1ef69 /castle-search/test | |
| parent | 74ff9fdcb8b49a021b63ac2e6b0191e29754d0f3 (diff) | |
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.
Diffstat (limited to 'castle-search/test')
| -rw-r--r-- | castle-search/test/extraction-config.test.ts | 16 |
1 files changed, 16 insertions, 0 deletions
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"); +}); |
