Skip to content

SearchIndexBuilder

Declares a search index and the Templates whose Items it indexes.

The index is queried at run time through apps.<app>.searches.<key>. Its member Templates are tracked in a Union with the same key on the declaring App.

TTypes extends AppBuilderTypes = AppBuilderTypes

Generated type mapping of the App, used to type indexed Items.

readonly prn: string

Platform Resource Name of the declared resource, derived from the App key and resource key.

BaseBuilder.prn


readonly union: UnionBuilder

Union holding the indexed Templates.

addTemplate<TTemplate>(template, handler): this

Indexes Items of a Template using the given handler.

TTemplate extends TemplateBuilder

Template being indexed, used to type the handler’s Item.

TTemplate

Template whose Items are indexed.

SearchIndexHandler<ExtractReadItem<TTemplate["prn"], TTypes>>

Converter from an Item to text and facets.

this

This builder for chaining.

The handler converts each Item into text for term searches and facets for facet queries. Adding a Template that is already indexed replaces its handler.

SearchIndexHandler


setDescription(description): this

Sets the description emitted into the definition and rendered in generated reference and application assets.

string

Human-readable description of the resource.

this

This builder for chaining.

BaseBuilder.setDescription


toDefinition(): SearchIndexDefinition

Emits the Definition of this index, including its handlers keyed by Template PRN.

SearchIndexDefinition