The SearchFilter interface
In Sitecore Search, you can override or update a widget's configuration at runtime. You do this in the search request itself. Various rules are driven by the values of attributes of the entity in the request.
This topic describes the interface of the filters used when configuring these rules at runtime.
SearchFilter interface
|
Property |
Type |
Description |
|---|---|---|
|
|
string |
Required. The type of filter. It is the operator used to filter based on attribute value. |
|
|
string |
Name of the attribute to use for ranking. |
|
|
Array<any> |
List of values filtered against. |
Unless indicated otherwise, all values are optional.
SearchFilter types or operators
Most rules use filters to include or exclude items. The following table lists different values for operators or types.
|
Value |
Description |
|---|---|
|
allOf |
Use all given values to find a match. |
|
and |
Add nested filters, all of which must match to get a result. For example, if you nest a gte and lt filter within and, you request results that are both greater than and less than a certain amount. |
|
anyOf |
Use any of the given values to find a match. |
|
eq |
Get a match only if the item is an exact match for the string you provide. |
|
exists |
Get a match only if the given attribute is present in the item. |
|
geoDistance |
Get a match only if the item is within a circular area you define. |
|
geoWithin |
Get a match only if the item is within a polygonal area you define. |
|
gt |
Get a match only if the item is greater than the value you specify. |
|
gte |
Get a match only if the item is greater than or equal to the value you specify. |
|
lt |
Get a match only if the item is less than the value you specify. |
|
lte |
Get a match only if the item is less than or equal to the value you specify. |
|
not |
Get a match only if the item is not any of the values you specify. |
|
or |
Add nested filters, any of which can match to get a result. For example, if you nest a lt and gt filter within and, you request results that are either less than or greater than a certain amount. |