dyna-record
    Preparing search index...

    Function Searchable

    • A layered decorator marking a string attribute as the entity's searchable text for vector search. Stack it over a string attribute decorator; the base decorator continues to own the attribute's alias, nullability, and validation — @Searchable() only adds the searchable mark.

      The decorated property must carry the Searchable brand — applying the decorator to a plain string property is a compile error. The brand alone confers nothing; without the decorator the attribute is a normal string attribute.

      IMPORTANT! - An entity may declare at most one searchable attribute. This is enforced at metadata initialization, together with the requirement that the layered-over attribute is a string attribute.

      Type Parameters

      • T extends default

        The entity the decorator is applied to, extending DynaRecord.

      • K extends Optional<Searchable>

        The type of the decorated property, which must carry the Searchable brand.

      Returns (_value: undefined, context: ClassFieldDecoratorContext<T, K>) => void

      A class field decorator function that registers the searchable mark with the ORM's metadata system, reconciled at metadata initialization.

      Usage example:

      @Entity
      class Listing extends MyTable {
      declare readonly type: "Listing";

      @Searchable()
      @StringAttribute({ alias: "Description" })
      public readonly description: Searchable;

      @Searchable()
      @StringAttribute({ alias: "Summary", nullable: true })
      public readonly summary?: Searchable; // nullable variant
      }