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

2 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_...'
// }

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)
})