SearchIndexContext
Collects the text and facets that describe one Item in a search index.
Remarks
Section titled “Remarks”Text is matched by search terms; facets are exact key:value strings matched by facet queries.
Every method ignores undefined and empty input, so Property values can be passed without
checks.
Methods
Section titled “Methods”email()
Section titled “email()”email(
key):this
Adds email:<address> and emailDomain:<domain> facets for an email address.
Parameters
Section titled “Parameters”string | undefined
Email address, or undefined to add nothing.
Returns
Section titled “Returns”this
This context for chaining.
Remarks
Section titled “Remarks”The address is trimmed and lowercased. Input that is not an email address is ignored.
facet()
Section titled “facet()”facet(
key):this
Adds a facet, conventionally in the form key:value such as tier:team.
Parameters
Section titled “Parameters”string | undefined
Facet string, or undefined to add nothing.
Returns
Section titled “Returns”this
This context for chaining.
Remarks
Section titled “Remarks”The facet is trimmed and truncated to 256 characters. An Item may carry at most 128 facets.
Throws
Section titled “Throws”When the Item already carries the maximum number of facets.
text()
Section titled “text()”text(
text,weight?):this
Adds text to the Item’s searchable content, optionally at a higher weight.
Parameters
Section titled “Parameters”string | undefined
Text to index, or undefined to add nothing.
weight?
Section titled “weight?”25 | 50 | 75 | 100
Ranking weight of this text.
Returns
Section titled “Returns”this
This context for chaining.
Remarks
Section titled “Remarks”Text may be added several times; entries of the same weight are concatenated. Each entry is
truncated to 16,384 characters. Higher weights rank matches higher: 100 is the highest and
25 the lowest.
Default Value
Section titled “Default Value”25Example
Section titled “Example”Weighting the title above the body
ctx.text(item.properties.title, 100).text(item.properties.body);uuid()
Section titled “uuid()”uuid(
key):this
Adds a uuid:<id> facet for an identifier.
Parameters
Section titled “Parameters”string | { id: string; } | undefined
UUID, object with an id, or undefined to add nothing.
Returns
Section titled “Returns”this
This context for chaining.
Remarks
Section titled “Remarks”Accepts a string or any object with an id, such as an Item. The value is trimmed and
lowercased; input that is not a UUID is ignored.

