Skip to content

contentSearch

Queryin Content

The published pages and articles that match searchTerm, at most limit (and never more than 20), and where the CMS's keyword list sends the term. Answered by the CMS's own search, or by a search engine that indexes the content.

Arguments

ArgumentTypeDescription
searchTermString!
limitInt!Default 3

Returns

ContentSearchResult!

FieldTypeDescription
hits[ContentSearchHit!]!The best matching pages and articles, at most limit.
redirectSearchRedirectWhere the CMS's keyword list sends this search term. Null where none matches.

Example

query ContentSearch($searchTerm: String!, $limit: Int!) {
contentSearch(searchTerm: $searchTerm, limit: $limit) {
hits {
excerpt
}
redirect {
kind
path
pageType
}
}
}

The query selects the return type's fields two levels deep; pick the ones you need. The response shows its shape with placeholder values.

Used by

The storefront packages that send it, in these GraphQL documents: