Taxonomy
Taxonomy
Taxonomy helps you categorize pieces of content within your stack to facilitate easy navigation and retrieval of information.
NoteAll methods in the Query section are applicable for taxonomy-based filtering as well.
equalAndBelow
The equalAndBelow method retrieves all entries for a specific taxonomy that match a specific term and all its descendant terms, requiring only the target term.
NoteThis query is applicable for the stack.Taxonomies() and stack.ContentType('uid').Query() methods.
| Name | Type | Description |
|---|---|---|
| key (required) | string | UID of the taxonomy field, specified as "taxonomies.<taxonomy_uid>" |
| value (required) | string | UID of the term to match or compare |
| levels | int | Depth level till which terms will be matched |
Example:
let data;
stack
.ContentType('ct_uid')
.Query()
.equalAndBelow("taxonomies.taxonomy_uid", "term_uid", 3)
.toJSON()
.find()
.then(response => {
// the response
data = response;
})below
The below method retrieves all entries for a specific taxonomy that match all of their descendant terms by specifying only the target term and a specific level.
NoteIf you don't specify the level, the default behavior is to retrieve terms up to level 10.
| Name | Type | Description |
|---|---|---|
| key (required) | string | UID of the taxonomy field, specified as "taxonomies.<taxonomy_uid>" |
| value (required) | string | UID of the term to match or compare |
| levels | int | Depth level till which terms will be matched |
Example:
let data;
stack
.ContentType('ct_uid')
.Query()
.below("taxonomies.taxonomy_uid", "term_uid", 3)
.toJSON()
.find()
.then(response => {
// the response
data = response;
})equalAndAbove
The equalAndAbove method retrieves 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.
NoteIf you don't specify the level, the default behavior is to retrieve terms up to level 10.
| Name | Type | Description |
|---|---|---|
| key (required) | string | UID of the taxonomy field, specified as "taxonomies.<taxonomy_uid>" |
| value (required) | string | UID of the term to match or compare |
| levels | int | Depth level till which terms will be matched |
Example:
let data;
stack
.Taxonomies()
.equalAndAbove("taxonomies.taxonomy_uid", "term_uid", 3)
.toJSON()
.find()
.then(response => {
// the response
data = response;
})above
The above method retrieves all entries for a specific taxonomy that match only the parent term(s) of a specified target term, excluding the target term itself and a specified level.
NoteIf you don't specify the level, the default behavior is to retrieve terms up to level 10.
| Name | Type | Description |
|---|---|---|
| key (required) | string | UID of the taxonomy field, specified as "taxonomies.<taxonomy_uid>" |
| value (required) | string | UID of the term to match or compare |
| levels | int | Depth level till which terms will be matched |
Example:
let data;
stack
.ContentType('ct_uid')
.Query()
.above("taxonomies.taxonomy_uid", "term_uid", 3)
.toJSON()
.find()
.then(response => {
// the response
data = response;
})