search.ts

Source

8 documented symbols. Read the signatures first, then expand each item for parameters, return types, and examples.

Reference

fnbuildSearchIndex(srcDir: string, base: string): Promise<string>Builds the search index from Markdown files.

Builds the search index from Markdown files.

View source

Parameters

  • srcDir string
  • base string

Returns

Promise
fncollectMarkdownFiles(dir: string): Promise<string[]>Collects all Markdown files from a directory.

Collects all Markdown files from a directory.

View source

Parameters

  • dir string

Returns

Promise
fngenerateSearchModule(options: ResolvedSearchOptions, indexPath: string): stringClient-side search module code. This is injected into the bundle as a virtual m…

Client-side search module code. This is injected into the bundle as a virtual module.

View source

Parameters

  • options ResolvedSearchOptions
  • indexPath string

Returns

string
fngetSearchDocumentScopes(doc: Pick<SearchDocument, "id" | "url">): string[]Derives hierarchical search scopes from a document id or URL. For example, `api…

Derives hierarchical search scopes from a document id or URL. For example, api/math/index yields ["api", "api/math"].

View source

Parameters

  • doc Pick

Returns

string[]
fnmatchesSearchScopes(doc: Pick<SearchDocument, "id" | "url">, scopes: string[]): booleanReturns true when a search document belongs to at least one requested scope.

Returns true when a search document belongs to at least one requested scope.

View source

Parameters

  • doc Pick
  • scopes string[]

Returns

boolean
fnparseScopedSearchQuery(query: string): ScopedSearchQuerySplits a raw query into free-text terms and @scope prefixes.

Splits a raw query into free-text terms and @scope prefixes.

View source

Parameters

  • query string

Returns

ScopedSearchQuery
fnresolveSearchOptions(options: SearchOptions | boolean | undefined): ResolvedSearchOptionsResolves search options with defaults.

Resolves search options with defaults.

View source

Parameters

  • options SearchOptions | boolean | undefined

Returns

ResolvedSearchOptions
fnwriteSearchIndex(indexJson: string, outDir: string): Promise<void>Writes the search index to a file.

Writes the search index to a file.

View source

Parameters

  • indexJson string
  • outDir string

Returns

Promise