Member Junction
    Preparing search index...

    Server-side Query Engine that wraps QueryEngine and adds server-only capabilities.

    Uses composition (containment) rather than inheritance to avoid duplicate data loading. Delegates all base functionality to QueryEngine.Instance while adding server-specific features like embedding-based semantic search.

    Follows the same pattern as AIEngine containing AIEngineBase.

    ONLY USE ON SERVER-SIDE. For metadata only, use the QueryEngine class which can be used anywhere.

    Hierarchy (View Summary)

    Index

    Constructors

    Accessors

    Methods

    • Configures the QueryEngineServer by first ensuring QueryEngine is configured, then building the in-memory vector index from cached query embeddings.

      Safe to call from multiple places concurrently — returns the same promise to all callers during loading.

      Parameters

      • OptionalforceRefresh: boolean

        If true, forces a full reload even if already loaded

      • OptionalcontextUser: UserInfo

        User context for server-side operations

      • Optionalprovider: IMetadataProvider

        Optional metadata provider override

      Returns Promise<void>

    • Find queries semantically similar to a natural language search text.

      Uses the persistent in-memory vector index built from QueryEngine's cached query data. Supports an optional metadata filter callback for filtering by status, reusable flag, etc. at search time.

      Parameters

      • searchText: string

        Natural language description of what data is needed

      • embedFunction: (
            text: string,
        ) => Promise<{ model: MJAIModelEntityExtended; result: EmbedTextResult }>

        Function to generate embeddings (typically from AIEngine.EmbedTextLocal)

      • topK: number = 10

        Maximum number of results to return (default: 10)

      • minSimilarity: number = 0.3

        Minimum similarity score 0-1 (default: 0.3)

      • Optionalfilter: (metadata: QueryEmbeddingMetadata) => boolean

        Optional filter callback applied to metadata before similarity scoring

      Returns Promise<QueryMatchResult[]>

      Array of matching queries sorted by similarity score (highest first)

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

      Returns GlobalObjectStore

    • Rebuilds the in-memory vector index from QueryEngine's cached queries. This is a synchronous, in-memory-only operation — no database call.

      Called automatically on Config() and whenever QueryEngine emits a DataChange$ event for the 'MJ: Queries' entity.

      Returns void

    • Returns 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.

      Type Parameters

      Parameters

      • this: new () => T
      • OptionalclassName: string

      Returns T