Fulltext Search in Javascript
You can use the Fulltext predicate to search a document for a given term or terms.
The fulltext predicate searches the term in any of the following fields:
- Rich Text
- Title
- Key Text
- UID
- Select
To learn more about this predicate checkout the Fulltext section on the Query Predicate Reference page.
Note that the fulltext search is not case sensitive.
The following example shows how to query all the documents of the custom type "blog-post" that contain the word "prismic".
Copy
// To retrieve the API object check how to query the API
api.query([
Prismic.Predicates.at('document.type', 'blog-post'),
Prismic.Predicates.fulltext('document', 'prismic')
]).then(function(response) {
// response is the response object, response.results holds the documents
});