Augmented Search allows the search dataset to be filtered by passing various parameters to the search node. Different from the search string (the "q" parameter), this feature allows building more complex search criteria (for example, by date or by field value).
Augmented search provides access to a set of filter aliases to perform common filtering operations. The following aliases are available:
Using aliases is particularly useful for simple queries, available parameters are detailed in the GraphQL schema. An alias can be used in conjunction with custom filters, in such cases, an "AND" operator is applied between those.
Custom filters allow for building complex querying logic and are particularly useful when users are presented with a search UI containing facets.
Custom filters work with any fields (jahia-native of custom properties) defined in your Elasticsearch schema, the only constraint being to make sure it matches the data types (for example, by only requesting numberRange filters on a numerical fields).
Custom filters support three types of filters:
When used together an AND operator is applied between custom filters and values within custom filters.
The dataRange filter allows for operation on date fields, using an array of ranges, as the simplified example below demonstrates.
query {
search(
q: "jahia"
filters: {
custom: {
dateRange: [
{ ranges: [{ field: "jcr:lastPublished", after: "now-12y", before: "now-1M" }] }
]
}
}
) {
results {
hits {
displayableName
lastPublished
}
totalHits
}
}
}
This allows the building of complex search experiences such as all documents:
The numberRange filter has a very similar behavior to dataRange, but operates on numbers instead of dates.
The term filter allows filtering based on field values, for example, all articles published by "root", as shown in the example below:
query {
search(
q: "jahia"
filters: {
custom: {
term: [
{terms: [{field: "jgql:createdBy", value: "root"}]}
]
}
}
) {
results {
hits {
displayableName
createdBy
}
totalHits
}
}
}
All of the filters described here can be combined in a single query. In this case, the AND operator is used between filters.