Filter
The Filter Resource is a json
object that contains the information related to a filter. It is very similar to the facet value resource, with some adjustments, as follows:
Name |
Type |
Description |
---|---|---|
properties |
Object |
A dictionary object containing the properties and values. |
remove |
A hyperlink to the resource that represents the search with this filter removed. Note: if there are other filters depending on the respective filter, these will also be removed by clicking this link. | |
Entity |
Link |
A hyperlink to the resource that represents the entity behind this filter value (if any) |
Example of a Non-Ranged Filter Resource
{
"properties": {
"title": "display text/value for the filter value",
"matches": 96,
"identifier": "filter value identifier - could be Redis entity id or Redis definition name or solr field name",
"operator": "filter operator",
"positive": true if the filter is positive, false if it's negative,
"type": "type of the solr field on which this filter is applied",
"ranged": false
},
"remove": {
"query": "myQueryWithThisFilterAndAllTheDependentFiltersRemoved",
"href": "http://<hostname>/api/search?q=myQueryWithThisFilterAndAllTheDependentFiltersRemoved&skip=10&take=10"
},
"Entity": {
"href": "http://<hostname>/api/entities/entityId"
}
}
Example of a Ranged Filter Resource
{
"properties": {
"title1": "display text/value for the lower filter value",
"identifier1": "identifier for the lower filter value",
"title2": "display text/value for the higher filter value",
"identifier2": "identifier for the higher filter value",
"operator": "Between",
"positive": true if the filter is positive, false if it's negative,
"type": "type of the solr field on which this filter is applied",
"ranged": true
},
"remove": {
"query": "myQueryWithThisFilterAndAllTheDependentFiltersRemoved",
"href": "http://<hostname>/api/search?q=myQueryWithThisFilterAndAllTheDependentFiltersRemoved&skip=10&take=10"
},
"Entity": null
}
Filter Operators
The filter operators is a set of values used to identify the operation desired as follows:
Oprator |
Description |
---|---|
Equals |
when wanting perfect equality, unless the filter is a full-text filter, in which case use a "Contains" operator. This operator is used with non-ranged filters. |
Contains |
the filter value is contained by the field value. This is used for text filters, only with non-ranged filters. |
StartWith |
the field value starts with the filter value. This is used for text fields, only with non-ranged filters. |
EndsWith |
the field value ends with the filter value. This is used for text fields only with non-ranged filters. |
LessThan |
the filter value is smaller than the field value. This is used for date and number fields, only with non-ranged filters. |
GreaterThan |
the filter value is larger than the field value. This is used for date and number fields, only with non-ranged filters. |
Between |
the field value is between the 2 filter values. This is used for date and number fields, only with ranged filters. |