Fulltext Search

You can use the Fulltext predicate to search a document for a given term or terms. It searches the term in the Rich Text, Key Text, UID, and Select Fields. To learn more about this predicate checkout the Queries page.

Query for all the documents of the custom type “blog-post” that contain the word “prismic”.

Copy
      api.query([
    Prismic.Predicates.at('document.type', 'blog-post'),
    Prismic.Predicates.fulltext('document', 'prismic')
]).then(function(blogPosts) {
    // blogPosts is the response object, blogPosts.results holds the documents
});
    
Copy
      $blogPosts = $api->query(
    [ Predicates::at('document.type', 'blog-post'),
      Predicates::fulltext('document', 'prismic') ]
);
// $blogPosts contains the response object, $blogPosts->getResults() holds the documents
    
Copy
      blog_posts = api.query([
    Prismic::Predicates.at("document.type", "blog-post"),
    Prismic::Predicates.fulltext("document", "prismic")
])
# blog_posts contains the response object, blog_posts.results holds the documents