public static class Form.SearchForm extends Object
Api object, you get a SearchForm form like this: api.getForm("everything");
Then, from a SearchForm form, you query like this: search.query("[[:d = at(document.type, "Product")]]").ref(ref).submit();| Constructor and Description |
|---|
SearchForm(Api api,
Form form) |
| Modifier and Type | Method and Description |
|---|---|
Form.SearchForm |
fetch(String... fields)
Restrict the document fragments to the set of fields specified.
|
Form.SearchForm |
fetchLinks(String... fields)
Include the specified fragment in the details of DocumentLink
|
Form.SearchForm |
lang(String lang)
Allows to set the language you want to get for your query.
|
Form.SearchForm |
orderings(String... orderings)
Allows to set which ordering you want for your query.
|
Form.SearchForm |
page(int page)
Allows to set which page you want to get for your query.
|
Form.SearchForm |
page(String page)
Allows to set which page you want to get for your query.
|
Form.SearchForm |
pageSize(int pageSize)
Allows to set the size of the pagination of the query's response.
|
Form.SearchForm |
pageSize(String pageSize)
Allows to set the size of the pagination of the query's response.
|
Form.SearchForm |
query(Predicate... predicates)
Allows to set the query field of the current form, using Predicate objects.
|
Form.SearchForm |
query(String q)
Allows to set the query field of the current form.
|
Form.SearchForm |
ref(Ref ref)
Allows to set the ref on which you wish to be performing the query.
|
Form.SearchForm |
ref(String ref)
Allows to set the ref on which you wish to be performing the query.
|
Form.SearchForm |
set(String field,
Integer value)
A simple helper to set numeric value; see set(String,String).
|
Form.SearchForm |
set(String field,
String value)
Allows to set one of the form's fields, such as "q" for the query field, or the "ordering" field, or the "pageSize" field.
|
Response |
submit()
The method to call to perform and retrieve your query.
|
String |
toString() |
public Form.SearchForm set(String field, String value)
searchForm.orderings(o) rather than searchForm.set("orderings", o)
if they exist.field - the name of the field to setvalue - the value with which to set itpublic Form.SearchForm set(String field, Integer value)
field - the name of the field to setvalue - target valuepublic Form.SearchForm lang(String lang)
lang - the language code you wishpublic Form.SearchForm ref(Ref ref)
api.getForm("everything").submit();, the kit will complain!
Please do not forge the ref dynamically in this call, like this: ref(api.getMaster()).
Prefer to set a ref variable once for your whole webpage, and use that variable in this method: ref(ref).
That way, you can change this variable's assignment once, and trivially set your whole webpage into the future or the past.ref - the ref object representing the ref on which you wish to querypublic Form.SearchForm ref(String ref)
api.getForm("everything").submit();, the kit will complain!
Please do not forge the ref dynamically in this call, like this: ref(api.getMaster().getRef()).
Prefer to set a ref variable once for your whole webpage, and use that variable in this method: ref(ref).
That way, you can change this variable's assignment once, and trivially set your whole webpage into the future or the past.ref - the ID of the ref on which you wish to querypublic Form.SearchForm pageSize(String pageSize)
api.getForm("everything").pageSize("15").ref(ref).submit();.pageSize - the size of the pagination you wishpublic Form.SearchForm pageSize(int pageSize)
api.getForm("everything").pageSize(15).ref(ref).submit();.pageSize - the size of the pagination you wishpublic Form.SearchForm page(String page)
api.getForm("everything").page("2").ref(ref).submit();
(do remember that the default size of a page is 20, you can change it with pageSize)page - the page numberpublic Form.SearchForm fetch(String... fields)
fields - the fields to returnpublic Form.SearchForm fetchLinks(String... fields)
fields - the fields to returnpublic Form.SearchForm page(int page)
api.getForm("everything").page(2).ref(ref).submit();
(do remember that the default size of a page is 20, you can change it with pageSize)page - the page numberpublic Form.SearchForm orderings(String... orderings)
api.getForm("products").orderings("my.product.price desc", "my.product.date").ref(ref).submit();
Read prismic.io's API documentation to learn more about how to write orderings.orderings - one or more ordering, as the name of a field optionally followed by "desc"public Form.SearchForm query(String q)
search.query("[[:d = at(document.type, "Product")]]");
Look up prismic.io's documentation online to discover the possible query predicates.
Beware: a query is a list of predicates, therefore, it always starts with "[[" and ends with "]]".q - the query to passpublic Form.SearchForm query(Predicate... predicates)
search.query(Predicates.at("document.type", "Product"));
See io.prismic.Predicates for more helper methods.predicates - any number of predicate, is more than one is provided documents that satisfy all predicates will be returned ("AND" query)public Response submit()
Copyright © 2017. All rights reserved.