ODS - Search Facets
The ODS Search API supports facetting. This means that a search result can be grouped based on available properties. The grouping contains a collection of possible options for the property. Each option has a label, value and a total item count.
Facets are applied on the search result of the request which means that in combination with filters, the facet result will be different.
Examples
This search request will return a facet result where 2 facets are included: variety and country.
{
"page":"1",
"pageSize":"5",
"facets": [
{
"attribute": "variety"
},
{
"attribute": "country"
}
]
}
This search request will return 3 facets where price is a range facet:
{
"page":"1",
"pageSize":"5",
"facets": [
{
"attribute": "variety"
},
{
"attribute": "country"
},
{
"attribute": "price",
"ranges": [
"-10",
"10-30",
"30-80",
"80-"
]
}
]
}
This search request will return the same facets as in previous example but with a filter applied:
{
"page":"1",
"pageSize":"5",
"filter": "country.eq.france",
"facets": [
{
"attribute": "variety"
},
{
"attribute": "country"
},
{
"attribute": "price",
"ranges": [
"-10",
"10-30",
"30-80",
"80-"
]
}
]
}