dyna-record
    Preparing search index...

    Interface VectorIndexMetadata<Members, Scoped>

    Represents the metadata for a vector index defined on a table class through the static vectorIndexes factory, and carries the index-anchored search surface. Holds the consumer-supplied configuration (name, vector attribute, 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, members) 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 vectorIndexes factory and drive the search surface only: Members is the index's member entity union (the explicit members: list) 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.

    interface VectorIndexMetadata<
        Members extends default = default,
        Scoped extends boolean = boolean,
    > {
        __members?: Members;
        __scoped?: Scoped;
        members: readonly (() => EntityClass<default>)[];
        model: EmbeddingModelDescriptor;
        name: string;
        provider: Optional<EmbeddingProvider>;
        scopedBy?: () => EntityClass<default>;
        tableClassName: string;
        vectorAttribute: VectorAttributeName;
        get fingerprint(): string;
        get hashAlias(): Optional<string>;
        get inlineFilterAliases(): readonly string[];
        get memberEntities(): readonly string[];
        resolveSearchSchema(params: ResolveSearchSchemaParams): void;
        search<const In extends string = never>(
            this: VectorIndexMetadata<Members, true>,
            scopeId: string,
            query: SearchQuery,
            options?: IndexSearchOptions<Members, In>,
        ): Promise<InferSearchResults<NarrowMembersByName<Members, In>>>;
        search<const In extends string = never>(
            this: VectorIndexMetadata<Members, false>,
            query: SearchQuery,
            options?: IndexSearchOptions<Members, In>,
        ): Promise<InferSearchResults<NarrowMembersByName<Members, In>>>;
    }

    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

    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
    members: readonly (() => EntityClass<default>)[]

    Entity thunks declaring the index's complete membership

    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

    vectorAttribute: VectorAttributeName

    The table attribute the index's vectors are written under — the index's physical membership surface. The narrow type is truthful: registration validates the reserved-prefix rule before any construct is built

    Accessors

    • get fingerprint(): string

      Stable fingerprint of the search-schema configuration (HASH alias, sorted inline filter aliases, dimensions, distance function, vector attribute) so IaC can detect that a declaration change implies a destructive index replacement. Empty until metadata initialization resolves it. Read-only

      Returns string

    • get inlineFilterAliases(): readonly string[]

      Sorted table aliases of the index's inline filters, including the auto-declared entity type filter. Empty until metadata initialization resolves it. Read-only: the returned array is frozen

      Returns readonly string[]

    • get memberEntities(): readonly string[]

      Class names of the searchable member entities of the index. Empty until metadata initialization resolves it. Read-only: the returned array is frozen

      Returns readonly string[]

    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, discriminated via entity.type.

      Scoped indexes take the scope value first — they are searchable only per scope value. Unscoped 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 supportSearchIndex.search("how do refunds work");
      
    • 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, discriminated via entity.type.

      Scoped indexes take the scope value first — they are searchable only per scope value. Unscoped 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 supportSearchIndex.search("how do refunds work");