Class Taxonomy
- Since:
- v1.13.0
- Author:
- Shailesh Mishra
Taxonomy : Taxonomy, currently in the Early Access Phase simplifies the process of organizing content in your system, making it effortless to find and retrieve information. - See Also:
-
Method Summary
Modifier and TypeMethodDescriptionAbove Operator :AND Operator :Below OperatorequalAbove(String taxonomy, String termUid) Equal and Above Operator :equalAndBelow(String taxonomy, String termsUid) Equal and Below Operator :equalAndBelowWithLevel(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.Exists Operator :voidfind(TaxonomyCallback callback) Find.Get all entries for a specific taxonomy that satisfy the given conditions provided in the '$in' query.OR Operator :
-
Method Details
-
in
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
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
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
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
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
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
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
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
Find.- Parameters:
callback- the callback
-