Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

fix(search): forward domain filters to fire engine (#4617)

Gergő Móricza1d434be1a00
diff --git a/apps/api/src/search/execute.ts b/apps/api/src/search/execute.ts
index 341e751c1..7ddde049a 100644
--- a/apps/api/src/search/execute.ts
+++ b/apps/api/src/search/execute.ts
@@ -140,6 +140,8 @@ export async function executeSearch(
safe: options.safe,
type: searchTypes,
enterprise: options.enterprise,
+ includeDomains: options.includeDomains,
+ excludeDomains: options.excludeDomains,
})) as SearchV2Response);
let developerResults = developerResultsPromise
? await developerResultsPromise
diff --git a/apps/api/src/search/v2/fireEngine-v2.ts b/apps/api/src/search/v2/fireEngine-v2.ts
index fd27262a9..8441df7c7 100644
--- a/apps/api/src/search/v2/fireEngine-v2.ts
+++ b/apps/api/src/search/v2/fireEngine-v2.ts
@@ -47,6 +47,8 @@ export async function fire_engine_search_v2(
page?: number;
type?: SearchResultType | SearchResultType[];
enterprise?: ("default" | "anon" | "zdr")[];
+ includeDomains?: string[];
+ excludeDomains?: string[];
},
abort?: AbortSignal,
): Promise<SearchV2Response> {
@@ -68,6 +70,8 @@ export async function fire_engine_search_v2(
type: options.type || "web",
enterprise: options.enterprise,
safe: options.safe ? ("active" as const) : undefined,
+ includeDomains: options.includeDomains,
+ excludeDomains: options.excludeDomains,
};
const requestedTypes = normalizeSearchTypes(options.type);
diff --git a/apps/api/src/search/v2/index.ts b/apps/api/src/search/v2/index.ts
index 999dec3df..aa60b170d 100644
--- a/apps/api/src/search/v2/index.ts
+++ b/apps/api/src/search/v2/index.ts
@@ -22,6 +22,8 @@ export async function search({
timeout = 5000,
type = undefined,
enterprise = undefined,
+ includeDomains = undefined,
+ excludeDomains = undefined,
}: {
query: string;
logger: Logger;
@@ -39,6 +41,8 @@ export async function search({
timeout?: number;
type?: SearchResultType | SearchResultType[];
enterprise?: ("default" | "anon" | "zdr")[];
+ includeDomains?: string[];
+ excludeDomains?: string[];
}): Promise<SearchV2Response> {
try {
if (config.FIRE_ENGINE_BETA_URL) {
@@ -54,11 +58,16 @@ export async function search({
safe,
type,
enterprise,
+ includeDomains,
+ excludeDomains,
});
return results;
}
+ // includeDomains/excludeDomains are enforced on returned URLs only on
+ // the fire engine path above; the fallback providers below receive them
+ // solely as the site: chain baked into the query.
if (config.SEARXNG_ENDPOINT) {
logger.info("Using searxng search");
const results = await searxng_search(query, {