Number & Range

Number & range

Copy
      "number" : {
  "type" : "Number",
  "fieldset" : "Number",
  "config" : {
    "label" : "Number",
    "min" : 10,
    "max" : 20
  }
}
    
Copy
      "range" : {
  "type" : "Range",
  "fieldset" : "Range",
  "config" : {
    "label" : "Range",
    "min" : 10,
    "max" : 100
  }
}
    

Reference

type

string

Number or Range

fieldset

string

a user-friendly field label

config

object

objects listed below

config

label

string

user-friendly label before the field

min

integer

min value

max

integer

max value

Copy
      api.query([
  prismic.Predicates.at("document.type", "product"),
  prismic.Predicates.at("my.product.price", 3)
], { pageSize : 10 }).then(function(prismicdocs {
  res.render('index', {
    prismicdocs: prismicdocs.results
  });
});

    
Copy
      $response = $api->query(array(
    Predicates::at("document.type", "product"),
    Predicates::at("my.product.price", 3))
);
    
Copy
      Response response = api.query(
    Predicates.at("document.type", "product"),
    Predicates.at("my.product.price", 3)
).submit();
    
Copy
      response = api.query([
    Predicates.at("document.type", "product"),
    Predicates.fulltext("my.product.price", 3)
]);
    

Lesser-than (lt) and greater-than (gt) queries:

Copy
      api.query([
  prismic.Predicates.at("document.type", "product"),
  prismic.Predicates.lt("my.product.price", 3)
], { pageSize : 10 }).then(function(prismicdocs) {
  res.render('index', {
    prismicdocs: prismicdocs.results
  });
});
    
Copy
      $response = $api
    ->query(
        Predicates::at("document.type", "product"),
        Predicates::lt("my.product.price", 3))
    ->submit();
    
Copy
      Response response = api.query(
    Predicates.at("document.type", "product"),
    Predicates.lt("my.product.price", 3)
).submit();
    
Copy
      response = api.query([
    Predicates.at("document.type", "product"),
    Predicates.lt("my.product.price", 3)
]);
    
Copy
      api.query([
  prismic.Predicates.at("document.type", "product"),
  prismic.Predicates.gt("my.product.price", 3)
], { pageSize : 10 }).then(function(prismicdocs) {
  res.render('index', {
    prismicdocs: prismicdocs.results
  });
});
    
Copy
      $response = $api
    ->query(
        Predicates::at("document.type", "product"),
        Predicates::gt("my.product.price", 3))
    ->submit();
    
Copy
      Response response = api.query(
    Predicates.at("document.type", "product"),
    Predicates.gt("my.product.price", 3)
).submit();
    
Copy
      response = api.query([
    Predicates.at("document.type", "product"),
    Predicates.gt("my.product.price", 3)
]);
    

Orderings

Number fields can be used to order results.

Copy
      /*
Acending: '[my.product.price]'
Descending: '[my.product.price desc]'
*/
api.query(
  prismic.Predicates.at("document.type", "product"),
  { pageSize : 10, orderings: '[my.product.price desc]' }
).then(function(prismicdocs) {
  res.render('index', {
    prismicdocs: prismicdocs.results
  });
});
    
Copy
      $response = $api
    ->query(Predicates::at("document.type", "product"))
    ->orderings('[my.product.price desc]')
    ->submit();

    
Copy
      Response response = api
    .query(Predicates.at("document.type", "product"))
    .orderings("my.product.price desc")
    .submit();
    
Copy
      response = api
   .query(Predicate.at("document.type", "product"))
   .orderings("my.product.price desc")
   .submit
    
Copy
      input(type='number', value=prismicdoc.getNumber('product.price'))
    
Copy
      <input type="number" value="<?= $prismicdoc->getNumber('product.price')->getValue() ?>"/>
    
Copy
      <input type="number" value="${prismicdoc.getNumber("product.price").getValue()}"/>
    
Copy
      <input type="number" value="<%= @prismicdoc.get_number("product.price").value "/>