ProtectedBaseAccess the cached provider metadata from SearchEngineBase
ProtectedProviderResolve the metadata provider via SearchEngineBase (which extends BaseEngine and tracks ProviderToUse).
StaticInstanceStatic accessor for the global singleton instance
Test / admin hook: clear the result cache.
Initialize the search engine by reading active SearchProvider records from SearchEngineBase (which caches them via BaseEngine) and instantiating each via ClassFactory.
Safe to call multiple times (no-ops if already configured unless forceRefresh=true).
Engine configuration options
The user context for initialization
If true, re-initializes even if already configured
ProtectedfilterFilter search results by entity-level and row-level security permissions.
This is a safety net. Providers are expected to do per-provider permission push-down (Section 3.6 of plans/search-scopes-rag-plus.md). If this filter is removing more than a handful of results in practice, the responsible provider's push-down is incomplete and should be fixed.
Groups results by entity for efficient permission checking:
The Global Object Store is a place to store global objects that need to be shared across the application. Depending on the execution environment, this could be the window object in a browser, or the global object in a node environment, or something else in other contexts. The key here is that in some cases static variables are not truly shared because it is possible that a given class might have copies of its code in multiple paths in a deployed application. This approach ensures that no matter how many code copies might exist, there is only one instance of the object in question by using the Global Object Store.
Public hook for callers (e.g. the GraphQL resolver) to emit a Status='Forbidden' SearchExecutionLog row when they reject a request before delegating to Search. Without this, forbidden invocations never reach the analytics dashboard — exactly the signal admins need to spot users / agents trying to access scopes they shouldn't.
Quick preview search optimized for autocomplete / typeahead. Uses preview mode (no enrichment), limited to 8 results by default. Only runs providers that have SupportsPreview=true.
The search query text
Maximum number of preview results (default: 8)
The user performing the search
Search result in preview mode
Execute a multi-source search with RRF fusion and optional enrichment.
When params.ScopeIDs is provided, each scope runs independently and the results
are combined via cross-scope RRF before deduplication, re-ranking, and enrichment.
Search parameters
The user performing the search
Aggregated search result
Streaming variant of Search. Yields events as each pipeline stage produces output so the caller can emit partials to the UI / agent before fusion + reranking complete.
Phase 2C v1 semantics: runs the same internal pipeline as Search and emits synthetic events at each transition. This preserves all existing fusion / permission / dedup / enrich behavior — important because those steps have subtle correctness rules that we don't want to re-implement in a parallel code path. Per-provider partials are reconstructed from the final SourceCounts; a future refactor (Phase 2C v2) can split provider emission to true real-time concurrent emission once we measure that the synthetic phase is the actual bottleneck.
Cancellation: the consumer can stop iterating at any point — the underlying Search() will run to completion but its result is discarded. AbortSignal-based mid-pipeline cancellation is a Phase 2C v2 concern.
Event ordering:
provider events (one per non-empty source)fused eventreranked event (when a reranker is configured)final eventerror event in place of final.Protected StaticgetReturns the singleton instance of the class. If the instance does not exist, it is created and stored in the Global Object Store. If className is provided it will be used as part of the key in the Global Object Store, otherwise the actual class name will be used. NOTE: the class name used by default is the lowest level of the object hierarchy, so if you have a class that extends another class, the lowest level class name will be used.
OptionalclassName: string
Singleton search engine that orchestrates multi-source search with RRF fusion.
Providers are discovered from the MJ: Search Providers entity. Each active provider's DriverClass is resolved via ClassFactory to create an instance, which is then initialized with the provider's config from the DB record.
Usage: