FACET:VALUE
refers to a facet-value pair, such as, author:shakespeare
.
Filters
Filters excludes records that don’t match the filter.Scenario | JSON template |
---|---|
Select a category | { "filters":"FACET:VALUE" } |
Remove a category | { "filters":"NOT FACET:VALUE" } |
Remove several categories | { "filters":"NOT FACET:VALUE AND NOT FACET:VALUE" } |
VALUE
(such as William Shakespeare), wrap it in single quotes.
For example:
JSON
VALUE
contains an apostrophe (such as Tony d’Arbon),
escape the apostrophe with double backslashes and wrap the whole string in single quotes. For example:
JSON
Optional filters
Optional filters don’t remove records from the results, but they promote or demote matching records. You can fine-tune the behavior of optional filters with filter scores.Any attribute you want to use as an optional filter must be declared as a facet.
Examples for optional filters
The following examples show different use cases for optional filters, their JSON representation, and the effect on filter scoring.Promote a category
Filter scoring: +1 for all matching recordsJSON
Promote several categories with equal weight
Filter scoring: +1 for all records matching one or more filterJSON
Promote several categories with different weights per category
Filter scoring: +X or +Y, whichever matches and has the highest valueJSON
Promote several categories with a combined score
Filter scoring: +1 or +2, depending on the number of matching filtersJSON
Promote several categories with combined weighting
Filter scoring: +X, +Y, or +X+Y, depending on the matching filtersJSON
Demote a category
Filter scoring: +1 for all records that don’t match the filterJSON
Demote several categories equally
Filter scoring: +1 for all records that don’t match any of the filtersJSON
Optional filters with multiple words
Unlike filters, you don’t need to wrap a multi-wordVALUE
with single quotes if it contains spaces.
For example:
JSON