Specifying filters
Filters can be added to your query using a combination of rules and combined rules as described below.
Rules
The Rule object defines a simple rule that does not form part of a combined rule. In boolean terms, it would not form a parenthesed group.
Example
A simple filter rule to limit data to Adzuna Occupation Sector (category) 2 (IT Jobs):
"filter": {
"type": "rule",
"dimension": "category",
"operator": "eq",
"target": {
"type": "object",
"id": 2,
"name": "IT Jobs"
}
}
Combined rules
For complex filtering, Rule objects can be combined with boolean AND or OR logic by defining a CombinedRule object.
Combined rules can also contain nested combined rules.
Example
A combined filter rule that includes postings for Adzuna Occupation Sector/Category 2 (IT Jobs) but excludes apprenticeships:
"filter": {
"type": "combined_rule",
"logic": "and",
"groups": [
{
"type": "rule",
"dimension": "category",
"operator": "eq",
"target": {
"type": "object",
"id": 2,
"name": "IT Jobs"
}
},
{
"type": "rule",
"dimension": "apprenticeship_level",
"operator": "none"
}
]
}
Any and None operators
Some dimensions allow filtering using the operators any
or none
. When there operators are used, the target
property must be omitted from the rule definition.
"filter": {
"type": "rule",
"dimension": "apprenticeship_level",
"operator": "any"
}
Filter targets
When defining a filter rule, a filter target
must be specified (unless using the any
or none
operator).
The type of target depends on the dimension being used in the rule.
ObjectFilterTarget
An ObjectFilterTarget is used when the target dimension is an object defined in one of our taxonomies eg. occupation, skill, location, company etc.
Example
Using an ObjectFilterTarget to filter a query by a specific Adzuna Occupation Sector (Category):
"filter": {
"type": "rule",
"dimension": "category",
"operator": "eq",
"target": {
"type": "object",
"id": 2,
"name": "IT Jobs"
}
}
StringFilterTarget
A StringFilterTarget is used when the target dimension is filtered by defined string values.
Example
Using a StringFilterTarget to filter a query by a specific apprenticeship level:
"filter": {
"type": "rule",
"dimension": "apprenticeship_level",
"operator": "eq",
"target": {
"type": "string",
"value": "level_2"
}
}
ScalarFilterTarget
A ScalarTargetValue is used when the target dimension is a scalar value eg. salary.
Example
Using a ScalarFilterTarget to limit a query to postings advertising a salary greater than or equal to £30,000:
"filter": {
"type": "rule",
"dimension": "salary",
"operator": "gte",
"target": {
"type": "scalar",
"value": 30000
}
}