From 3e6cd361589bf443f2abb3e504f545febbf4de0e Mon Sep 17 00:00:00 2001 From: diegosouzapw Date: Mon, 10 Aug 2026 10:14:00 -0300 Subject: [PATCH] fix(search): nest Exa contents options for /search (#9914) --- changelog.d/fixes/9914-search-exa-contents.md | 1 + open-sse/handlers/search.ts | 6 ++++-- tests/unit/search-handler-extended.test.ts | 5 ++--- 3 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 changelog.d/fixes/9914-search-exa-contents.md diff --git a/changelog.d/fixes/9914-search-exa-contents.md b/changelog.d/fixes/9914-search-exa-contents.md new file mode 100644 index 0000000000..506fe9ebed --- /dev/null +++ b/changelog.d/fixes/9914-search-exa-contents.md @@ -0,0 +1 @@ +- fix(search): nest Exa contents options (text/highlights) for /search API (#9914) diff --git a/open-sse/handlers/search.ts b/open-sse/handlers/search.ts index 502bc2ee73..bad08b9998 100644 --- a/open-sse/handlers/search.ts +++ b/open-sse/handlers/search.ts @@ -336,8 +336,10 @@ function buildExaRequest( query: params.query, numResults: params.maxResults, type: "auto", - text: true, - highlights: true, + contents: { + text: true, + highlights: true, + }, }; if (includes.length) body.includeDomains = includes; if (excludes.length) body.excludeDomains = excludes; diff --git a/tests/unit/search-handler-extended.test.ts b/tests/unit/search-handler-extended.test.ts index 8d1449b56f..1c687ec7dc 100644 --- a/tests/unit/search-handler-extended.test.ts +++ b/tests/unit/search-handler-extended.test.ts @@ -123,7 +123,7 @@ test("handleSearch builds Brave news requests and normalizes favicon metadata", } }); -test("handleSearch builds Exa requests with include/exclude domains and preserves rich result fields", async () => { +test("handleSearch builds Exa requests with contents-nested options, include/exclude domains, and preserves rich result fields", async () => { const originalFetch = globalThis.fetch; let captured; @@ -165,8 +165,7 @@ test("handleSearch builds Exa requests with include/exclude domains and preserve query: "agentic workflows", numResults: 5, type: "auto", - text: true, - highlights: true, + contents: { text: true, highlights: true }, includeDomains: ["allowed.com"], excludeDomains: ["blocked.com"], category: "news",