1. Search request

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

PropertyTypeDescription
typestringRequired.

The type of filter. It is the operator used to filter based on attribute value.
namestringName of the attribute to use for ranking.
valuesArrayList of values filtered against.
Note

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.

ValueDescription
allOfUse all given values to find a match.
andAdd 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.
anyOfUse any of the given values to find a match.
eqGet a match only if the item is an exact match for the string you provide.
existsGet a match only if the given attribute is present in the item.
geoDistanceGet a match only if the item is within a circular area you define.
geoWithinGet a match only if the item is within a polygonal area you define.
gtGet a match only if the item is greater than the value you specify.
gteGet a match only if the item is greater than or equal to the value you specify.
ltGet a match only if the item is less than the value you specify.
lteGet a match only if the item is less than or equal to the value you specify.
notGet a match only if the item is not any of the values you specify.
orAdd 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.
If you have suggestions for improving this article, let us know!