Member Junction
    Preparing search index...

    Server-only Tag Engine that wraps TagEngineBase via composition and adds semantic embedding support for tag resolution.

    Uses SimpleVectorService to embed all tags for sub-millisecond local similarity matching. This enables the ResolveTag() method which maps free-text tag strings to formal Tag records.

    ONLY USE ON SERVER-SIDE. For client-side tag operations, use TagEngineBase directly.

    Hierarchy (View Summary)

    Index

    Constructors

    Accessors

    • get GlobalKey(): string

      Returns string

    Methods

    • Used by MJTagEntityServer.Save() after a tag's persisted vector has been written: lift the vector from the entity into the in-memory cache without re-running embedding. No-op if the vector service hasn't been initialized.

      Parameters

      Returns void

    • Initialize the TagEngine by loading the base engine and building tag embeddings. Safe to call multiple times; subsequent calls are no-ops unless forceRefresh is true.

      Parameters

      • OptionalforceRefresh: boolean

        If true, reload all data and rebuild embeddings

      • OptionalcontextUser: UserInfo

        Required for server-side operations

      Returns Promise<void>

    • Propose a hierarchical tag taxonomy for a content source WITHOUT persisting anything. Reuses ClusteringEngine over a sample of the source's content-item embeddings (clusters are LLM-named), and falls back to a single AI prompt over a sample of content when embeddings are unavailable.

      Parameters

      • sourceID: string

        ContentSource ID whose items seed the taxonomy.

      • sampleSize: number

        Max number of content items to consider.

      • OptionalcontextUser: UserInfo

        User context (required server-side).

      • Optionalprovider: IMetadataProvider

        Optional metadata provider override.

      Returns Promise<SeedTaxonomyResult>

      The proposed taxonomy tree + provenance metadata (nothing is saved).

    • 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

    • Public utility: rebuild persisted embeddings for tags whose model doesn't match the currently configured embedding model. Intended for one-shot admin invocation after the global tag-embedding model is changed, or for scheduled health jobs. Returns the count of tags refreshed.

      Parameters

      Returns Promise<{ refreshed: number; total: number }>

    • Re-embed a tag after it has been renamed or its description changed. Updates the vector in the active vector service. No-op if the vector service is not available (e.g., before BuildTagVectors has been called).

      Parameters

      • tag: MJTagEntity

        The tag entity with the updated name/description already saved

      Returns Promise<void>

    • Remove a tag's embedding from the vector service (e.g., after deletion). No-op if the vector service is not initialized.

      Parameters

      • tagID: string

      Returns void

    • Resolve a free-text tag to a formal Tag record using exact match and semantic search.

      Resolution strategy:

      1. Exact name match (fast path, no embedding needed)
      2. Fuzzy match (plurals, hyphens, whitespace normalization)
      3. Semantic similarity search using vector embeddings
      4. Auto-creation based on mode if no match found

      Parameters

      • tagText: string

        The free-text tag string to resolve

      • weight: number

        The weight to assign if creating a new tag (0.0 to 1.0)

      • mode: TaxonomyMode

        Resolution mode:

        • 'constrained': Only match existing tags, return null if no match
        • 'auto-grow': Create a new tag under rootID if no match found
        • 'free-flow': Create a new root-level tag if no match found
      • rootID: string

        If set, constrain semantic search to this subtree. Also used as parent for auto-grow.

      • threshold: number

        Minimum similarity score (0-1) for a match to be accepted

      • contextUser: UserInfo

        The user context for the operation

      • Optionaloptions: ResolveTagOptions

      Returns Promise<MJTagEntity>

      The matched or newly created MJTagEntity, or null if no match in constrained mode

    • 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