⚠️ Work in progress — createCMS is pre-1.0 and not production-ready (not tested in production). Expect breaking changes.
createCMS
Reference

Search

Full-text search across CMS entities, via cms.api.search.

Full-text search runs over a maintained index spanning seven entity types: root, comment, mergeRequest, variable, template, asset, and notification. The method lives at cms.api.search.query and mirrors on the client as client.search.query with identical types.

Results honour the caller's read boundary: rows are returned only when their underlying entity is visible under the active plugin scope, and notification rows surface only to their recipient.

Methods

Search Across Entities

Run one full-text query across every indexed entity and get back matches ranked by relevance. Narrow the search by entity type, collection, or entry, and use each result's highlight string (with <mark> around the matched terms) to show users exactly where they matched.

search:read
GET/search/query
const { data, error } = await client.search.query({
  query: {
    search: 'homepage', // required
    entityTypes: ['root', 'variable'],
    limit: 10,
  },
});
Parameters
searchstringrequired

Search term. Parsed as a websearch query.

entityTypes('root' | 'comment' | 'mergeRequest' | 'variable' | 'template' | 'asset' | 'notification')[]

Restrict to these entity types. Also accepts a comma-separated string.

collectionstring

Restrict to a single collection.

rootIdstring

Restrict to a single entry.

limitnumber= 20

Page size, 1 to 100.

offsetnumber= 0

Rows to skip.

Returns
resultsSearchResult[]

The matches on this page, ranked by relevance (highest `rank` first). See the shape below.

totalnumber

Total number of matches across all pages, ignoring limit/offset.

hasMoreboolean

Whether more matches exist after this page.

Each result has entityType, entityId, optional collection / rootId / title / snippet / meta, a rank (relevance), and a highlight string with <mark> around the matched terms.

Rebuilding the index

cms.api.admin.reindexSearch rebuilds the whole index. See the Server API.

On this page