Senzing Node.js SDK
    Preparing search index...

    Class SzEngine

    Index

    Constructors

    Methods

    • Primes the engine for optimal performance by loading internal caches.

      Returns void

    • Primes the engine for optimal performance by loading internal caches.

      Returns void

      const engine = env.getEngine();
      engine.primeEngine();
      console.log("Engine caches loaded");
    • Gets engine performance statistics as a JSON string.

      Returns string

    • Gets engine performance statistics as a JSON string.

      Returns string

      const stats = JSON.parse(engine.getStats());
      console.log("Workload stats:", JSON.stringify(stats.workload, null, 2));
    • Adds a record for entity resolution.

      Inserts or updates a record in the entity repository.

      Parameters

      • dataSourceCode: string
      • recordId: string
      • recordDefinition: string
      • Optionalflags: bigint

      Returns string

    • Adds a record for entity resolution.

      Parameters

      • dataSourceCode: string
      • recordId: string
      • recordDefinition: string
      • Optionalflags: bigint

      Returns string

      const info = engine.addRecord(
      "CUSTOMERS", "1001",
      JSON.stringify({ NAME_FULL: "Robert Smith", DATE_OF_BIRTH: "1985-02-15" }),
      SzFlags.WITH_INFO,
      );
      const affected = JSON.parse(info).AFFECTED_ENTITIES;
    • Deletes a record from the entity repository.

      Parameters

      • dataSourceCode: string
      • recordId: string
      • Optionalflags: bigint

      Returns string

    • Deletes a record from the entity repository.

      Parameters

      • dataSourceCode: string
      • recordId: string
      • Optionalflags: bigint

      Returns string

      const info = engine.deleteRecord("CUSTOMERS", "1001", SzFlags.WITH_INFO);
      console.log("Affected entities:", JSON.parse(info).AFFECTED_ENTITIES);
    • Reevaluates a specific record against current resolution rules.

      Parameters

      • dataSourceCode: string
      • recordId: string
      • Optionalflags: bigint

      Returns string

    • Reevaluates all records for a specific entity.

      Parameters

      • entityId: number
      • Optionalflags: bigint

      Returns string

    • Reevaluates all records for a specific entity.

      Parameters

      • entityId: number
      • Optionalflags: bigint

      Returns string

      const info = engine.reevaluateEntity(1, SzFlags.WITH_INFO);
      const affected = JSON.parse(info).AFFECTED_ENTITIES;
      console.log("Reevaluation affected:", affected.length, "entities");
    • Gets record information by data source and record ID.

      Parameters

      • dataSourceCode: string
      • recordId: string
      • Optionalflags: bigint

      Returns string

    • Gets a preview of how a record would be processed without persisting it.

      Parameters

      • recordDefinition: string
      • Optionalflags: bigint

      Returns string

    • Gets entity information by entity ID.

      Parameters

      • entityId: number
      • Optionalflags: bigint

      Returns string

    • Gets entity information by entity ID.

      Parameters

      • entityId: number
      • Optionalflags: bigint

      Returns string

      const result = engine.getEntityById(1, SzFlags.ENTITY_DEFAULT_FLAGS);
      const entity = JSON.parse(result).RESOLVED_ENTITY;
      console.log("Entity name:", entity.ENTITY_NAME);
    • Gets entity information by record key (data source + record ID).

      Parameters

      • dataSourceCode: string
      • recordId: string
      • Optionalflags: bigint

      Returns string

    • Gets entity information by record key (data source + record ID).

      Parameters

      • dataSourceCode: string
      • recordId: string
      • Optionalflags: bigint

      Returns string

      const result = engine.getEntityByRecord(
      "CUSTOMERS", "1001",
      SzFlags.ENTITY_DEFAULT_FLAGS,
      );
      const entity = JSON.parse(result).RESOLVED_ENTITY;
      console.log("Entity ID:", entity.ENTITY_ID);
    • Searches for entities by attributes.

      Parameters

      • attributes: string
      • OptionalsearchProfile: string
      • Optionalflags: bigint

      Returns string

    • Searches for entities by attributes.

      Parameters

      • attributes: string
      • OptionalsearchProfile: string
      • Optionalflags: bigint

      Returns string

      const attrs = JSON.stringify({ NAME_FULL: "Robert Smith", DATE_OF_BIRTH: "1985-02-15" });
      const result = engine.searchByAttributes(attrs, undefined, SzFlags.SEARCH_BY_ATTRIBUTES_DEFAULT_FLAGS);
      const entities = JSON.parse(result).RESOLVED_ENTITIES;
      console.log(`Found ${entities.length} matching entities`);
    • Analyzes why a search result was returned for an entity.

      Parameters

      • attributes: string
      • entityId: number
      • OptionalsearchProfile: string
      • Optionalflags: bigint

      Returns string

    • Analyzes why two entities are related.

      Parameters

      • entityId1: number
      • entityId2: number
      • Optionalflags: bigint

      Returns string

    • Analyzes why two entities are related.

      Parameters

      • entityId1: number
      • entityId2: number
      • Optionalflags: bigint

      Returns string

      const result = engine.whyEntities(1, 2, SzFlags.WHY_ENTITIES_DEFAULT_FLAGS);
      const whyResults = JSON.parse(result).WHY_RESULTS;
      console.log("Match level:", whyResults[0].MATCH_INFO.WHY_KEY);
    • Analyzes why two records resolved together.

      Parameters

      • dsCode1: string
      • recId1: string
      • dsCode2: string
      • recId2: string
      • Optionalflags: bigint

      Returns string

    • Analyzes why two records resolved together.

      Parameters

      • dsCode1: string
      • recId1: string
      • dsCode2: string
      • recId2: string
      • Optionalflags: bigint

      Returns string

      const result = engine.whyRecords(
      "CUSTOMERS", "1001",
      "WATCHLIST", "2001",
      SzFlags.WHY_RECORDS_DEFAULT_FLAGS,
      );
      const whyResults = JSON.parse(result).WHY_RESULTS;
      console.log("Match key:", whyResults[0].MATCH_INFO.MATCH_KEY);
    • Analyzes why a record belongs to its current entity.

      Parameters

      • dataSourceCode: string
      • recordId: string
      • Optionalflags: bigint

      Returns string

    • Analyzes how an entity was constructed step by step.

      Parameters

      • entityId: number
      • Optionalflags: bigint

      Returns string

    • Creates a virtual entity from record keys without persisting.

      Parameters

      Returns string

    • Finds interesting entities related to a given entity by entity ID.

      Parameters

      • entityId: number
      • Optionalflags: bigint

      Returns string

    • Finds interesting entities related to a given entity by record key.

      Parameters

      • dataSourceCode: string
      • recordId: string
      • Optionalflags: bigint

      Returns string

    • Finds a relationship path between two entities.

      Parameters

      • startEntityId: number
      • endEntityId: number
      • maxDegrees: number
      • OptionalavoidEntityIds: number[]
      • OptionalrequiredDataSources: string[]
      • Optionalflags: bigint

      Returns string

    • Finds a relationship path between two entities.

      Parameters

      • startEntityId: number
      • endEntityId: number
      • maxDegrees: number
      • OptionalavoidEntityIds: number[]
      • OptionalrequiredDataSources: string[]
      • Optionalflags: bigint

      Returns string

      const result = engine.findPath(
      1, 2, 3,
      undefined, undefined,
      SzFlags.FIND_PATH_DEFAULT_FLAGS,
      );
      const path = JSON.parse(result).ENTITY_PATHS[0];
      console.log("Path length:", path.ENTITIES.length);
    • Finds a network of related entities starting from seed entity IDs.

      Parameters

      • entityIds: number[]
      • maxDegrees: number
      • buildOutDegree: number
      • maxEntities: number
      • Optionalflags: bigint

      Returns string

    • Finds a network of related entities starting from seed entity IDs.

      Parameters

      • entityIds: number[]
      • maxDegrees: number
      • buildOutDegree: number
      • maxEntities: number
      • Optionalflags: bigint

      Returns string

      const result = engine.findNetwork(
      [1, 2], 3, 1, 100,
      SzFlags.FIND_NETWORK_DEFAULT_FLAGS,
      );
      const network = JSON.parse(result);
      console.log("Entities in network:", network.ENTITY_PATHS.length);
    • Gets the next pending redo record from the queue.

      Returns string

    • Gets the next pending redo record from the queue.

      Returns string

      const redo = engine.getRedoRecord();
      if (redo) {
      const info = engine.processRedoRecord(redo, SzFlags.WITH_INFO);
      console.log("Processed redo:", JSON.parse(info).AFFECTED_ENTITIES);
      }
    • Processes a redo record for deferred resolution.

      Parameters

      • redoRecord: string
      • Optionalflags: bigint

      Returns string

    • Processes a redo record for deferred resolution.

      Parameters

      • redoRecord: string
      • Optionalflags: bigint

      Returns string

      const redo = engine.getRedoRecord();
      if (redo) {
      const info = engine.processRedoRecord(redo, SzFlags.WITH_INFO);
      console.log("Affected:", JSON.parse(info).AFFECTED_ENTITIES);
      }
    • Starts a JSON entity export. Returns an export handle.

      Parameters

      • Optionalflags: bigint

      Returns number

    • Starts a JSON entity export. Returns an SzExportIterator.

      Parameters

      • Optionalflags: bigint

      Returns SzExportIterator

      const iter = engine.exportJsonEntityReport(SzFlags.EXPORT_DEFAULT_FLAGS);
      for (const chunk of iter) {
      const lines = chunk.split("\n").filter(Boolean);
      for (const line of lines) {
      const entity = JSON.parse(line);
      console.log("Entity:", entity.RESOLVED_ENTITY.ENTITY_ID);
      }
      }
    • Fetches the next batch of export data. Returns empty string when complete.

      Parameters

      • exportHandle: number

      Returns string

    • Closes an export operation and releases resources.

      Parameters

      • exportHandle: number

      Returns void