Class Taxonomy
- java.lang.Object
-
- com.contentstack.sdk.Taxonomy
-
public class Taxonomy extends Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Taxonomyabove(String taxonomy, String termUid)Above Operator :Taxonomyand(List<org.json.JSONObject> listOfItems)AND Operator :Taxonomybelow(String taxonomy, String termsUid)Below OperatorTaxonomyequalAbove(String taxonomy, String termUid)Equal and Above Operator :TaxonomyequalAndBelow(String taxonomy, String termsUid)Equal and Below Operator :TaxonomyequalAndBelowWithLevel(String taxonomy, String termsUid, int level)Note: If you don't specify the level, the default behavior is to retrieve terms up to level 10.Taxonomyexists(String taxonomy, Boolean value)Exists Operator :voidfind(TaxonomyCallback callback)Find.Taxonomyin(String taxonomy, List<String> listOfItems)Get all entries for a specific taxonomy that satisfy the given conditions provided in the '$in' query.Taxonomyor(List<org.json.JSONObject> listOfItems)OR Operator :
-
-
-
Method Detail
-
in
public Taxonomy in(String taxonomy, List<String> listOfItems)
Get all entries for a specific taxonomy that satisfy the given conditions provided in the '$in' query. Your query should be as follows:{"taxonomies.taxonomy_uid" : { "$in" : ["term_uid1" , "term_uid2" ] }}Example: If you want to retrieve entries with the color taxonomy applied and linked to the term red and/or yellow.
{"taxonomies.color" : { "$in" : ["red" , "yellow" ] }}- Parameters:
taxonomy- the key of the taxonomy to querylistOfItems- the list of taxonomy fields- Returns:
- an instance of the Taxonomy with the specified conditions added to the query
-
or
public Taxonomy or(@NotNull List<org.json.JSONObject> listOfItems)
OR Operator :Get all entries for a specific taxonomy that satisfy at least one of the given conditions provided in the “$or” query.
Your query should be as follows:
{ $or: [ { "taxonomies.taxonomy_uid_1" : "term_uid1" }, { "taxonomies.taxonomy_uid_2" : "term_uid2" } ]}Example: If you want to retrieve entries with either the color or size taxonomy applied and linked to the terms yellow and small, respectively.
{ $or: [ { "taxonomies.color" : "yellow" }, { "taxonomies.size" : "small" } ]}- Parameters:
listOfItems- the list of items- Returns:
- instance
Taxonomy
-
and
public Taxonomy and(@NotNull List<org.json.JSONObject> listOfItems)
AND Operator :Get all entries for a specific taxonomy that satisfy all the conditions provided in the “$and” query.
Your query should be as follows:
{ $and: [ { "taxonomies.taxonomy_uid_1" : "term_uid1" }, { "taxonomies.taxonomy_uid_2" : "term_uid2" } ] }Example: If you want to retrieve entries with the color and computers taxonomies applied and linked to the terms red and laptop, respectively.{ $and: [ { "taxonomies.color" : "red" }, { "taxonomies.computers" : "laptop" } ] }- Parameters:
listOfItems- the list of items to that you want to include in the query string- Returns:
- instance of the Taxonomy
-
exists
public Taxonomy exists(@NotNull String taxonomy, @NotNull Boolean value)
Exists Operator :Get all entries for a specific taxonomy that if the value of the field, mentioned in the condition, exists.
Your query should be as follows:
{"taxonomies.taxonomy_uid" : { "$exists": true }}Example: If you want to retrieve entries with the color taxonomy applied.{"taxonomies.color" : { "$exists": true }}- Parameters:
taxonomy- the taxonomyvalue- the value of the field- Returns:
- instance of Taxonomy
-
equalAndBelow
public Taxonomy equalAndBelow(@NotNull String taxonomy, @NotNull String termsUid)
Equal and Below Operator :Get all entries for a specific taxonomy that match a specific term and all its descendant terms, requiring only the target term and a specified level.
Note: If you don't specify the level, the default behavior is to retrieve terms up to level 10.
{"taxonomies.taxonomy_uid" : { "$eq_below": "term_uid", "level" : 2}}Example: If you want to retrieve all entries with terms nested under blue, such as navy blue and sky blue, while also matching entries with the target term blue.{"taxonomies.color" : { "$eq_below": "blue" }}- Parameters:
taxonomy- the taxonomytermsUid- the term uid- Returns:
- instance of Taxonomy
-
equalAndBelowWithLevel
public Taxonomy equalAndBelowWithLevel(@NotNull String taxonomy, @NotNull String termsUid, @NotNull int level)
Note: If you don't specify the level, the default behavior is to retrieve terms up to level 10.- Parameters:
taxonomy- the taxonomytermsUid- the termslevel- the level to retrieve terms up to mentioned level- Returns:
- instance of Taxonomy
-
below
public Taxonomy below(@NotNull String taxonomy, @NotNull String termsUid)
Below Operator
Get all entries for a specific taxonomy that match all of their descendant terms by specifying only the target term and a specific level.
Note: If you don't specify the level, the default behavior is to retrieve terms up to level 10.
{"taxonomies.taxonomy_uid" : { "$below": "term_uid", "level" : 2}}Example: If you want to retrieve all entries containing terms nested under blue, such as navy blue and sky blue, but exclude entries that solely have the target term blue.{"taxonomies.color" : { "$below": "blue" }}- Parameters:
taxonomy- the taxonomytermsUid- the terms uid- Returns:
- instance of Taxonomy
-
equalAbove
public Taxonomy equalAbove(@NotNull String taxonomy, @NotNull String termUid)
Equal and Above Operator :Get all entries for a specific taxonomy that match a specific term and all its ancestor terms, requiring only the target term and a specified level. Note: If you don't specify the level, the default behavior is to retrieve terms up to level 10.
{"taxonomies.taxonomy_uid": { "$eq_above": "term_uid", "level": 2 }}Example: If you want to obtain all entries that include the term led and its parent term tv.
{"taxonomies.appliances": { "$eq_above": "led"}}- Parameters:
taxonomy- the taxonomytermUid- the term uid- Returns:
- instance of Taxonomy
-
above
public Taxonomy above(@NotNull String taxonomy, @NotNull String termUid)
Above Operator :Get all entries for a specific taxonomy that match only the parent term(s) of a specified target term, excluding the target term itself. You can also specify a specific level.
Note: If you don't specify the level, the default behavior is to retrieve terms up to level 10.
{ "taxonomies.taxonomy_uid": { "$above": "term_uid", "level": 2 }}Example: If you wish to match entries with the term tv but exclude the target term led.
{"taxonomies.appliances": { "$above": "led" }}- Parameters:
taxonomy- the taxonomytermUid- the term uid- Returns:
- instance of
Taxonomy
-
find
public void find(TaxonomyCallback callback)
Find.- Parameters:
callback- the callback
-
-