Skip to article

Filter by domain

Validate hostnames before dispatch and check the complete fallback chain.

On this page

Request hostnames

filter.ts · fixture
import { createSearch } from '@belweave/search-sdk';
import { createMockProvider } from '@belweave/search-sdk/testing';

const client = createSearch({ provider: createMockProvider() });
const response = await client.web.search({
  query: 'search API reference',
  limit: 3,
  includeDomains: ['example.org'],
  excludeDomains: ['excluded.example.org'],
});

console.log(response.results); // Mock hostname filtering; no live search

Use ASCII hostnames or punycode. Schemes, paths, ports, wildcards, and empty lists are rejected. The SDK lowercases and deduplicates hosts. The same normalized host cannot appear in both lists.

Check provider capacity

AdapterInclude / exclude capacity
Valyu100 / 100 under SDK policy; web only
Context.dev100 / 100
TinyFish100 / 100 — conservative SDK policy
Exa1,200 / 1,200
Tavily300 / 150
Perplexity20 include or 20 exclude; mutually exclusive
Parallel200 include or 200 exclude; mutually exclusive SDK policy
Linkup100 / 50 under SDK policy
Firecrawl100 include or 100 exclude; mutually exclusive SDK policy
You.com500 include or 5,000 exclude; mutually exclusive
Brave / Serper / SerpAPI / SearXNGNeither filter supported by these normalized adapters

Every provider in a configured fallback chain must support the requested filters and capacity before any network dispatch. A Brave fallback makes a filtered request unsupported even when the primary supports it. A provider declaring mutuallyExclusiveDomainFilters rejects simultaneous lists before dispatch.

Keep matching semantics explicit

Built-in adapters forward native filter options. They do not rewrite the query into site: operators or remove provider results locally. Root-domain and subdomain behavior remains provider-specific; do not infer exact-host matching from the SDK's hostname syntax.