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/search/queryconst data = await cms.api.search.query({
query: {
search: 'homepage', // required
entityTypes: ['root', 'variable'],
limit: 10,
},
});const { data, error } = await client.search.query({
query: {
search: 'homepage', // required
entityTypes: ['root', 'variable'],
limit: 10,
},
});searchstringrequiredSearch 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.
collectionstringRestrict to a single collection.
rootIdstringRestrict to a single entry.
limitnumber= 20Page size, 1 to 100.
offsetnumber= 0Rows to skip.
resultsSearchResult[]The matches on this page, ranked by relevance (highest `rank` first). See the shape below.
totalnumberTotal number of matches across all pages, ignoring limit/offset.
hasMorebooleanWhether 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.