Member Junction
    Preparing search index...

    Client for executing universal search operations through GraphQL. This class provides an easy way to search across knowledge sources from a client application, including vector search, full-text search, entity search, and file storage search.

    The GraphQLSearchClient follows the same naming convention as other GraphQL clients in the MemberJunction ecosystem, such as GraphQLActionClient and GraphQLAIClient.

    // Create the client
    const searchClient = new GraphQLSearchClient(graphQLProvider);

    // Execute a full search
    const result = await searchClient.ExecuteSearch({
    Query: "quarterly revenue",
    MaxResults: 20,
    MinScore: 0.5,
    Filters: {
    EntityNames: ["Invoices", "Reports"],
    SourceTypes: ["Vector", "FullText"]
    }
    });

    if (result.Success) {
    console.log(`Found ${result.TotalCount} results in ${result.ElapsedMs}ms`);
    for (const item of result.Results) {
    console.log(`${item.Title} (${item.Score})`);
    }
    }

    // Quick preview search
    const preview = await searchClient.PreviewSearch("budget report", 5);
    Index

    Constructors

    Methods

    • Execute a full knowledge search with optional filters and scoring controls.

      This method invokes the SearchKnowledge GraphQL mutation on the server and returns ranked results from multiple source types (vector, full-text, entity, storage).

      Parameters

      • params: SearchClientParams

        The search parameters including query, filters, and scoring options

      Returns Promise<SearchClientResponse>

      A Promise that resolves to a SearchClientResponse with ranked results

      const result = await searchClient.ExecuteSearch({
      Query: "customer satisfaction trends",
      MaxResults: 25,
      MinScore: 0.3,
      Filters: {
      EntityNames: ["Surveys", "Reports"],
      Tags: ["Q4", "customer-feedback"]
      }
      });

      if (result.Success) {
      console.log(`Source breakdown: Vector=${result.SourceCounts.Vector}, FullText=${result.SourceCounts.FullText}`);
      }
    • Query the list of MJ: Search Scopes the current user can see and use. Populates the scope selector in the UI. Returns an empty array on any failure.

      Returns Promise<SearchScopeInfo[]>

    • Execute a lightweight preview search with fewer fields returned.

      This method invokes the PreviewSearch GraphQL mutation, which returns a smaller payload suitable for autocomplete, type-ahead, or quick-lookup scenarios.

      Parameters

      • query: string

        The search query text

      • OptionalmaxResults: number

        Optional maximum number of results (defaults to server-side default)

      Returns Promise<SearchClientResponse>

      A Promise that resolves to a SearchClientResponse with preview results

      const preview = await searchClient.PreviewSearch("annual report", 5);
      if (preview.Success) {
      for (const item of preview.Results) {
      console.log(`${item.Title} - ${item.EntityName}`);
      }
      }
    • Phase 2C streaming search. Two-step protocol matching the resolver:

      1. Invoke the StreamScopedSearch mutation. The server returns { Success, StreamID } and starts the search in the background.
      2. Subscribe to SearchStreamEvents(streamID). Events arrive over the existing WebSocket subscription transport until a 'final' or 'error' phase, after which the caller should unsubscribe.

      Returns an Observable that emits SearchStreamNotification objects. The first emission is always the mutation acknowledgement (with Phase='start' and the StreamID); subsequent emissions are the server-pushed events. Callers should:

      • filter on Phase === 'final' for the canonical result set
      • listen for Phase === 'error' to surface failures to the user
      • call .unsubscribe() after the terminal event

      Parameters

      Returns Observable<
          {
              DurationMs?: number;
              ElapsedMs?: number;
              ErrorMessage?: string;
              Phase: string;
              ProviderName?: string;
              Results?: SearchClientResultItem[];
              SourceCounts?: {
                  Entity: number;
                  FullText: number;
                  Storage: number;
                  Vector: number;
              };
              StreamID: string;
          },
      >