Cosmos comes with a built-in search capability. It works by returning a list of all published pages that contain a snippet of text.
The list it returns is a JSON array like this: