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
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 |
|---|---|---|
|
| Base request options (custom fetch options) |
Returns: Promise<SearchConfig>
const config = await lynkow.search.getConfig()
// {
// host: 'https://search.lynkow.com',
// apiKey: 'eyJhbGciOi...',
// indexName: 'site_abc123_def4_...'
// }search
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 |
|---|---|---|
|
| The search query string. Typos are handled automatically<br> (e.g. |
|
| Optional filters and pagination:<br> - |
Returns: Promise<SearchResponse>
// 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)
})