Key Text

Plain text field

Copy
      "description" : {
  "type" : "Text",
  "fieldset" : "Product description",
  "config" : {
    "label" : "Label"
  }
}
    

Reference

type

string

Text

fieldset

string

a user-friendly field label

config

object

objects listed below

config

label

string

user-friendly label before the field

Text fields can be queried with a full-text predicate. Here is a full-text query on a custom type with an API ID of "blog-post".

Copy
      var terms = "javascript express";
api.query([
  prismic.Predicates.at("document.type", "blog-post"),
  prismic.Predicates.fulltext("my.blog-post.description", terms)
], { pageSize : 10 }).then(function(prismicdocs) {
  res.render('index', {
    prismicdocs: prismicdocs.results
  });
});
    
Copy
      $terms = "lorem ipsum";
$response = $api->query(array(
    Predicates::at("document.type", "blog-post"),
    Predicates::at("my.blog-post.description", $terms)
));
    
Copy
      Response response = api.query(
    Predicates.at("document.type", "blog-post"),
    Predicates.at("my.blog-post.description", terms) // terms is a String
).submit();
    
Copy
      response = api.query([
  Predicates.at("document.type", "blog-post"),
  Predicates.at("my.blog-post.description", terms) // terms is a string
]).submit
    

Text fields can be queried to match a certain string. Here is a query on a custom type with an API ID of "product" and the name "car".

Copy
      api.query([
  prismic.Predicates.at("document.type", "product"),
  prismic.Predicates.at("my.product.name", "car")
], { pageSize : 1 }).then(function(prismicdocs) {
  res.render('index', {
    prismicdoc: prismicdocs.results[0]
  });
});
    
Copy
      $response = $api->query(array(
    Predicates::at("document.type", "product"),
    Predicates::at("my.product.name", "car")
));
    
Copy
      Response response = api.query(
    Predicates.at("document.type", "product"),
    Predicates.at("my.product.name", "car")
).submit();
    
Copy
      response = api.query([
  Predicates.at("document.type", "product"),
  Predicates.at("my.product.name", "car")
]).submit
    

Orderings

Text fields can be used to order results.

Copy
      var terms = "javascript express";
api.query([
  prismic.Predicates.at("document.type", "blog-post"),
  prismic.Predicates.fulltext("my.blog-post.description", terms)
], { pageSize : 10, orderings : '[my.blog-post.description]' }).then(function(prismicdocs) {
  res.render('index', {
    prismicdocs: prismicdocs.results
  });
});
    
Copy
      $terms = "lorem ipsum";
$response = $api->query(array(
    Predicates::at("document.type", "blog-post"),
    Predicates::at("my.blog-post.description", $terms)),
    array("orderings", "[my.blog-post.description]")
);
    
Copy
      Response response = api.query(
    Predicates.at("document.type", "blog-post"),
    Predicates.at("my.blog-post.description", terms)
).orderings("my.blog-post.description").submit();
    
Copy
      response = api.query([
  Predicates.at("document.type", "product"),
], "orderings" => "my.blog-post.description").submit
    
Copy
      h1 
    != prismicdoc.getText('blog-post.title')
    
Copy
      <h1><?= $prismicdoc->getText('blog-post.title')->getValue() ?></h1>
    
Copy
      <h1>${prismicdoc.getText("blog-post.title").getValue()}</h1>
    
Copy
      <h1><%= @prismicdoc.get_text("blog-post.title").value %></h1>