OptionalContextMulti-tenant runtime context — filters results to a specific tenant/dimension.
OptionalEntitiesFor EntitySearchProvider / FullTextSearchProvider / TagSearchProvider: only search these
entities. Same contract as ExternalIndexes: undefined is unscoped (every searchable
entity), [] is no entity at all — never every entity.
OptionalExternalFor vector and 3rd-party index providers (Elasticsearch, Typesense, AzureAISearch, OpenSearch): only query these external indexes. Each entry carries its IndexType, native identifier, rendered MetadataFilter, and any ExternalIndexConfig.
[] and undefined mean opposite things. undefined means unscoped (no scope, or a global
scope): search everything available, including a configured default index. [] means the scope
gives this lane nothing: return no results without querying, and never fall back to a default
index. Test === undefined, never ?.length — []?.length is falsy, so the old
ExternalIndexes?.length ? scoped : defaultIndex pattern widens an empty scope to the default
index. BaseSearchProvider.ScopedExternalIndexRows applies the rule for one IndexType.
OptionalQueryOptional per-provider query rewrites. Map key is the provider's DriverClass or
SourceType. Provider uses this in place of the raw query when present.
OptionalScopeAdvanced scope config passed through verbatim. Providers may inspect this for provider-specific knobs (e.g., vector namespace, route key).
OptionalStorageFor StorageSearchProvider: only search these accounts/folders. Same contract as
ExternalIndexes: undefined is unscoped (every searchable account), [] is no account.
Constraints assembled from one or more
SearchScoperecords and handed to each provider so the provider can narrow its retrieval to the scoped surface and apply native permission / metadata push-down.Providers that receive
scopeConstraintsMUST implement permission push-down (see Section 3.6 of plans/search-scopes-rag-plus.md) — no result the calling user cannot see should ever enter RRF/re-rank.