Lynkow Instant Search service.

Accessible via lynkow.search. Provides full-text search with typo tolerance across all published content. Results are not cached (search queries are dynamic by nature).

Search must be enabled in the admin dashboard (Settings > SEO > Search) before it can be used. When disabled, all methods return a 503 error.

Access via: lynkow.search

Methods

4 methods

getConfig

TypeScript
getConfig(options?: BaseRequestOptions): Promise<SearchConfig>

Get search configuration for client-side direct search.

Returns the search host URL, a short-lived tenant token (JWT, 1-hour expiry), and the index name for your site. Use these values to query the search engine directly from the browser without round-tripping through your server.

The response is cached for 10 minutes. Tenant tokens expire after 1 hour — for long-lived pages, call this method periodically to refresh the token.

Parameter

Type

Description

options

BaseRequestOptions

Base request options (custom fetch options)

Returns: Promise<SearchConfig>

TypeScript
const config = await lynkow.search.getConfig()
// {
//   host: 'https://search.lynkow.com',
//   apiKey: 'eyJhbGciOi...',
//   indexName: 'site_abc123_def4_...'
// }

listProfiles

TypeScript
listProfiles(options?: BaseRequestOptions): Promise<SearchProfilePublic[]>

List the public search profiles configured for the site.

Site administrators can create multiple "search profiles", each scoped to a slice of the content (a category, a set of tags, a path prefix, etc.) with its own searchable/displayed fields and result limits. Use this method to render a profile selector or to drive a tabbed search experience (e.g. one tab per documentation space). Only profiles marked as public are returned; private profiles remain accessible via authenticated routes only.

Parameter

Type

Description

options

BaseRequestOptions

Base request options (custom fetch options)

Returns: Promise<SearchProfilePublic[]>

TypeScript
const profiles = await lynkow.search.listProfiles()
for (const profile of profiles) {
  console.log(profile.slug, profile.name)
}

TypeScript
search(query: string, options?: SearchOptions): Promise<SearchResponse>

Search published content with typo tolerance.

Queries the search index for articles matching the given query string. Results are ordered by relevance and include highlighted matches in the _formatted field.

Parameter

Type

Description

query

string

The search query string. Typos are handled automatically<br> (e.g. 'pagniation' finds articles about pagination).

options

SearchOptions

Optional filters and pagination:<br> - locale — filter by locale code (e.g. 'fr')<br> - category — filter by category slug (e.g. 'guides')<br> - tag — filter by tag slug (e.g. 'featured')<br> - page — page number, 1-based (default: 1)<br> - limit — results per page, 1--100 (default: 20)

Returns: Promise<SearchResponse>

TypeScript
// Basic search
const results = await lynkow.search.search('forms')

// With filters
const results = await lynkow.search.search('formulaire', {
  locale: 'fr',
  category: 'guides',
  page: 1,
  limit: 5,
})

// Access highlighted results
results.data.forEach(hit => {
  console.log(hit._formatted?.title || hit.title)
})

searchByProfile

TypeScript
searchByProfile(profileSlug: string, query: string, options?: SearchOptions): Promise<SearchResponse>

Search a specific profile.

Equivalent to search() but targets a named profile slug instead of the site default. The profile's scope, searchable subset, displayed subset, sort, facets, and limits are applied server-side. Use this to power per-section search experiences (API docs, marketing, help, etc.) without re-implementing scoping in the client.

Parameter

Type

Description

profileSlug

string

The profile's slug (e.g. 'api-docs').<br> Must reference a public profile.

query

string

The search query string. Typos are handled automatically.

options

SearchOptions

Optional locale/category/tag overrides plus pagination.<br> These are applied as additional AND filters on top of the profile scope.

Returns: Promise<SearchResponse>

TypeScript
const results = await lynkow.search.searchByProfile('api-docs', 'pagination', {
  limit: 10,
})