Member Junction
    Preparing search index...

    Interface IRunViewProvider

    Interface for providers that execute views. Supports parameterized view execution with filtering and pagination. Views are the primary way to query entity data in MemberJunction.

    interface IRunViewProvider {
        Config(configData: ProviderConfigDataBase): Promise<boolean>;
        FullTextSearch(
            params: FullTextSearchParams,
            contextUser?: UserInfo,
        ): Promise<FullTextSearchResult>;
        RunView<T = any>(
            params: RunViewParams,
            contextUser?: UserInfo,
        ): Promise<RunViewResult<T>>;
        RunViews<T = any>(
            params: RunViewParams[],
            contextUser?: UserInfo,
        ): Promise<RunViewResult<T>[]>;
        RunViewsWithCacheCheck?<T = unknown>(
            params: RunViewWithCacheCheckParams[],
            contextUser?: UserInfo,
        ): Promise<RunViewsWithCacheCheckResponse<T>>;
        SearchEntities(
            params: SearchEntityParams[],
        ): Promise<EntitySearchResult[][]>;
        SearchEntity(params: SearchEntityParams): Promise<EntitySearchResult[]>;
    }

    Implemented by

    Index

    Methods

    • Performs a full-text search across all entities that have FullTextSearchEnabled=true in their metadata. Uses the database-native full-text search capabilities (SQL Server FREETEXT via CodeGen-generated functions, PostgreSQL tsvector/GIN indexes, etc.) through the existing RunView + UserSearchString infrastructure.

      Parameters

      • params: FullTextSearchParams

        Search parameters including the search text and optional entity name filter

      • OptionalcontextUser: UserInfo

        Optional user context for permissions and row-level security

      Returns Promise<FullTextSearchResult>

      Array of search results grouped by entity, with title, snippet, and relevance score

    • Batch form of SearchEntity. Runs the per-entity ranking against many entities in one call. Transports as a single JSON payload in both directions over GraphQL when invoked through GraphQLDataProvider, so N entity searches cost one round-trip instead of N.

      Server-side providers fan the call out via Promise.all to independent SearchEntity invocations — each entity's lexical pass, semantic pass, blending, and permission filter run independently, and the per-entity result arrays come back aligned by input order.

      Use this whenever an agent or workflow needs ranked results from more than one entity for the same user request (e.g., "find anything relevant to 'overdue payments'" across Invoices, Customers, and Notes).

      Parameters

      Returns Promise<EntitySearchResult[][]>

      Array of result arrays, aligned by input order — result[i] holds the ranked matches for params[i].

    • Ranked search over one entity's records, blending lexical name/text-field matching with semantic embedding cosine. Results are post-filtered by the caller's row-level read permissions on that entity.

      Method Purpose
      EntityByName / EntityByID Look up an entity definition by name or ID. Deterministic, not ranked, returns EntityInfo.
      FullTextSearch Server-side text search across one or many entities using each entity's UserSearchString rule (DB-level LIKE / FTS). Returns flat per-entity result groups, no semantic ranking.
      SearchEntity (this) Hybrid lexical-plus-semantic ranking of records inside one entity, backed by an EntityDocument-driven vector index. Use when you need "the N most relevant records of this entity for the user's free-text request".
      SearchEntities Batch form — runs SearchEntity over many entities in one round-trip.

      Semantic ranking requires an Active EntityDocument of type Search registered for the target entity (see /metadata/entity-documents/ for the seeded one against MJ: Entities); without it, mode: 'semantic' returns no rows and mode: 'hybrid' degrades to lexical-only.

      Parameters

      Returns Promise<EntitySearchResult[]>

      Ranked EntitySearchResult[] — descending by score, sliced to topK.