Member Junction
    Preparing search index...

    Constraints assembled from one or more SearchScope records 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 scopeConstraints MUST 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.

    interface ScopeConstraints {
        Context?: SearchContext;
        Entities?: ScopeEntityConstraint[];
        ExternalIndexes?: ScopeExternalIndexConstraint[];
        QueryTransforms?: Record<string, string>;
        ScopeConfig?: Record<string, unknown>;
        StorageAccounts?: ScopeStorageConstraint[];
    }
    Index

    Properties

    Context?: SearchContext

    Multi-tenant runtime context — filters results to a specific tenant/dimension.

    For 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.

    ExternalIndexes?: ScopeExternalIndexConstraint[]

    For 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.

    QueryTransforms?: Record<string, string>

    Optional per-provider query rewrites. Map key is the provider's DriverClass or SourceType. Provider uses this in place of the raw query when present.

    ScopeConfig?: Record<string, unknown>

    Advanced scope config passed through verbatim. Providers may inspect this for provider-specific knobs (e.g., vector namespace, route key).

    StorageAccounts?: ScopeStorageConstraint[]

    For StorageSearchProvider: only search these accounts/folders. Same contract as ExternalIndexes: undefined is unscoped (every searchable account), [] is no account.