Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
TypeScript aiai-agentsai-crawlerai-scrapingai-searchcrawlerdata-extractionhtml-to-markdownllmmarkdownscraperscrapingweb-crawlerweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
fix: allow partial results when searching multiple sources (#2490)
devin-ai-integration[bot]73a25ef2c2af
diff --git a/apps/api/src/search/v2/fireEngine-v2.ts b/apps/api/src/search/v2/fireEngine-v2.tsindex 89d97323e..e89f53531 100644--- a/apps/api/src/search/v2/fireEngine-v2.ts+++ b/apps/api/src/search/v2/fireEngine-v2.ts@@ -21,11 +21,17 @@ function normalizeSearchTypes(return Array.isArray(type) ? type : [type];}-function hasCompleteResults(+/**+ * Checks if the response has at least one requested type with results.+ * This allows partial results to be returned when some sources have data+ * but others don't, instead of requiring all sources to have results.+ */+function hasAnyResults(response: SearchV2Response,requestedTypes: SearchResultType[],): boolean {- return requestedTypes.every(type => {+ if (!response || Object.keys(response).length === 0) return false;+ return requestedTypes.some(type => {const results = response[type];return Array.isArray(results) && results.length > 0;});@@ -72,7 +78,7 @@ export async function fire_engine_search_v2(const result = await executeWithRetry<SearchV2Response>(() => attemptRequest<SearchV2Response>(url, data, abort),(response): response is SearchV2Response =>- response !== null && hasCompleteResults(response, requestedTypes),+ response !== null && hasAnyResults(response, requestedTypes),abort,);