dyna-record
    Preparing search index...

    Class VectorIndexMetadata<Members, Scoped>

    Represents the metadata for a vector index defined on a table class through the static vectorIndex factory, and carries the index-anchored search surface. Holds the consumer-supplied configuration (name, model descriptor, provider, scope and membership thunks) plus the search schema resolved at metadata initialization (members, HASH alias, inline filter aliases, and the search-schema fingerprint).

    Entity thunks (scopedBy, include) are never resolved at definition time — resolution happens during metadata initialization so index constants can be declared at module evaluation without freezing metadata against a partial entity graph.

    The type parameters are instantiated by the vectorIndex factory's overloads and drive the search surface only: Members is the index's member entity union (scope parent's searchable adjacency union the include: list; unnarrowed for global indexes) and Scoped selects the scope-id-first search signature. Metadata-internal code uses the defaults.

    Name of the table class the index is defined on.

    Configuration options for the vector index.

    Type Parameters

    • Members extends default = default

      Union of the index's member entity types.

    • Scoped extends boolean = boolean

      Whether the index is scoped (scopedBy).

    Index

    Constructors

    Properties

    __members?: Members

    Phantom type markers carrying the factory-instantiated type parameters. declare emits nothing at runtime — they exist so the overloaded search signatures can select on scopedness and so member typing survives assignment. Never assigned or read

    __scoped?: Scoped
    fingerprint: string

    Stable fingerprint of the search-schema configuration (HASH alias, sorted inline filter aliases, dimensions, distance function) so IaC can detect that a decorator change implies a destructive index replacement. Placeholder, resolved at metadata initialization

    hashAlias?: string

    Table alias of the scoping foreign key attribute (the index HASH). Undefined for global indexes. Placeholder, resolved at metadata initialization

    include?: readonly (() => EntityClass<default>)[]

    Entity thunks adding FK-only members to a scoped index

    inlineFilterAliases: string[]

    Sorted table aliases of the index's inline filters, including the auto-declared entity type filter. Placeholder, resolved at metadata initialization

    memberEntities: string[]

    Class names of the searchable member entities of the index. Placeholder, resolved at metadata initialization

    The embedding model descriptor the index is provisioned with

    name: string

    The DynamoDB IndexName of the vector index

    The consumer-supplied embed function. Typed as required configuration; optional here so a missing provider (EX: plain JS consumers) is caught by metadata validation rather than a runtime crash.

    scopedBy?: () => EntityClass<default>

    Entity thunk selecting the scope parent, when the index is scoped

    tableClassName: string

    The name of the table class the index is defined on

    Methods

    • Searches the vector index. Compiles to exactly one SearchVectors operation; results carry complete typed entity instances with similarity and the raw score, ordered most-similar-first.

      The return type is inferred from in:: present, results narrow to that member entity; omitted, results are the index's full member union (including include: members), discriminated via entity.type. Global indexes return the base result type — their member set is only known at runtime.

      Scoped indexes take the scope value first — they are searchable only per scope value. Global indexes take the query first and no scope id.

      Type Parameters

      • const In extends string = never

      Parameters

      Returns Promise<InferSearchResults<NarrowMembersByName<Members, In>>>

      A promise resolving to the typed search results.

      const results = await storeSearchIndex.search("storeId", "ceramic mugs", {
      in: "Listing",
      filter: { category: "Mugs" },
      topK: 25
      });
      const results = await globalSearchIndex.search("fresh articles");
      
    • Searches the vector index. Compiles to exactly one SearchVectors operation; results carry complete typed entity instances with similarity and the raw score, ordered most-similar-first.

      The return type is inferred from in:: present, results narrow to that member entity; omitted, results are the index's full member union (including include: members), discriminated via entity.type. Global indexes return the base result type — their member set is only known at runtime.

      Scoped indexes take the scope value first — they are searchable only per scope value. Global indexes take the query first and no scope id.

      Type Parameters

      • const In extends string = never

      Parameters

      Returns Promise<InferSearchResults<NarrowMembersByName<Members, In>>>

      A promise resolving to the typed search results.

      const results = await storeSearchIndex.search("storeId", "ceramic mugs", {
      in: "Listing",
      filter: { category: "Mugs" },
      topK: 25
      });
      const results = await globalSearchIndex.search("fresh articles");