ProtectedconfigConfig from the SearchProvider metadata record, set during Initialize()
ReadonlySourceWhich search source this provider represents
StaticPerHow many rows to fetch PER ENTITY as the relevance-ranking candidate pool. This is
DELIBERATELY decoupled from the global topK budget (bug C3): previously the per-entity
limit was topK / entityCount floored at 3, so with ~150 searchable entities each entity
returned only ~3 arbitrary rows and real matches beyond row 3 were never fetched — and
enabling MORE entities starved each one further. Now each entity contributes up to this
many candidates; the engine still trims the fused, relevance-sorted result set back to
topK, so the returned count is unchanged — we only widen the candidate pool per entity.
Public + static so a deployment can tune it at startup (larger entity counts may lower it
to bound the row-materialization cost of the parallel fan-out), or override the default at
process start via the MJ_SEARCH_PER_ENTITY_FETCH_DEPTH environment variable.
StaticPerPer-entity hard timeout, in milliseconds. If one entity's RunView takes longer than this, we drop its results rather than hold the entire fan-out hostage. The query keeps running in SQL Server until completion (we can't cancel mssql Requests here), but the other entities' results still land for the user.
Public + static so a deployment can tune it at startup — mirroring
PerEntityFetchDepth. The 3s default keeps interactive/omnibar fan-outs
responsive by dropping a pathological entity promptly instead of stalling the
whole fan-out; deployments doing large unindexed LIKE scans can raise it, either
by overriding the default at process start via the MJ_SEARCH_PER_ENTITY_TIMEOUT_MS
environment variable or by assigning the static before serving:
import { EntitySearchProvider } from '@memberjunction/search-engine';
EntitySearchProvider.PerEntityTimeoutMS = 30_000;
Get the metadata provider used by this search provider, falling back to the global default.
Set the metadata provider used by this search provider for entity lookups.
Check and cache whether this provider is operational. Called after Initialize(). Override for providers that need to verify external dependencies (e.g., vector indexes exist, API keys are valid).
The default implementation returns true (always available).
The user context for availability checks
Initialize the provider with configuration from the SearchProvider entity. Called once during SearchEngine.Config(). Override to perform provider-specific setup (e.g., connecting to external APIs using credentials).
Configuration from the SearchProvider metadata record
The user context for initialization
Whether this provider is currently available (configured and operational). The SearchEngine will skip providers that return false.
Execute an entity search across all entities with AllowUserSearchAPI=true.
The search query text
Maximum number of results per entity
Optional filters (EntityNames to restrict search scope)
The user performing the search
OptionalscopeConstraints: ScopeConstraintsScored result items from entity search
StaticGetEnumerate every search provider currently registered with ClassFactory under
BaseSearchProvider. Designed for the SearchScope form's provider dropdown
(P5.5) — populates the dropdown from this single call rather than hardcoding
a list, so any ClassFactory-registered provider (including third-party ones)
shows up automatically.
Each entry includes the driver-class registration key (writes into
SearchProvider.DriverClass) and the SourceType the provider implements.
Sorted by DriverClass for stable UI ordering.
Provides entity-level LIKE-based search using RunView + UserSearchString. Searches all entities where AllowUserSearchAPI=true, returning results with rank-based scores.