Skip to content

search

search(query, items, options?): SearchResult[]

Perform fuzzy search over a list of strings.

Returns matches sorted by score (best match first). Scores are normalized to a 0.0-1.0 range where 1.0 is a perfect match. Uses the nucleo matcher (the one in the Helix editor): every character of each query term must occur in the item in order, so letters missing from the query are tolerated but substituted or swapped letters are not. Matches at the start of the item, at word boundaries and in consecutive runs score higher. Matching is smart case by default (see SearchOptions).

Terms are separated by any whitespace (including the ideographic space U+3000). A query without any search term (empty, whitespace-only or only syntax such as ^) returns no results, and so does a query containing a single term longer than 2,520 characters, which cannot be scored.

The third argument accepts either a number (maxResults for backward compatibility) or a SearchOptions object with maxResults and minScore. maxResults must be a non-negative integer or Infinity.

Parameter Type
query string
items readonly string[]
options? number | SearchOptions | null

SearchResult[]