search.ts
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.
Parameters
-
srcDirstring -
basestring
Returns
Promise
fncollectMarkdownFiles(dir: string): Promise<string[]>Collects all Markdown files from a directory.
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.
Parameters
-
optionsResolvedSearchOptions -
indexPathstring
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"].
Parameters
-
docPick
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.
Parameters
-
docPick -
scopesstring[]
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.
Parameters
-
querystring
Returns
ScopedSearchQuery
fnresolveSearchOptions(options: SearchOptions | boolean | undefined): ResolvedSearchOptionsResolves search options with defaults.
Resolves search options with defaults.
Parameters
-
optionsSearchOptions | 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.
Parameters
-
indexJsonstring -
outDirstring
Returns
Promise