filter( )
Creates a filter builder for building search filters.
The filter()
function is used for creating compound filters that are applied to a search using the
and()
, or()
, and not()
filtering functions. You do not need the filter()
function for applying most filtering
functions (such as eq()
or gt()
) to a search. Instead you can add WixSearchBuilder
filtering functions directly to your search.
The filter()
function creates a WixSearchFilterBuilder
object,
which contains functionality for creating compound filters for your site search.
The following describes a typical filter builder flow:
- Create a
WixSearchFilterBuilder
using thefilter()
function. - Create a
WixSearchFilter
by chaining a singleWixSearchFilterBuilder
filtering function, such aseq()
orgt()
, to the filter builder. You cannot chain more than 1 filtering function to aWixSearchFilterBuilder
. - Do one of the following:
- Create more filters: Pass one or more
WixSearchFilters
as parameters to anand()
,or()
, ornot()
WixSearchFilterBuilder
function to create a newWixSearchFilter
. For example,newFilter = wixSearch.filter().or(filter1, filter2)
. - Refine a search: Pass one or more
WixSearchFilters
as parameters to anand()
,or()
, ornot()
WixSearchBuilder
function to refine a search. For example,newSearchBuilder = wixSearch.search().or(filter1, filter2)
.
Note that only some fields can be filtered. Check which fields can be filtered in
the supported schemas for each documentType
.
Method Declaration
Copy
Request
This method does not take any parameters
Was this helpful?
Yes
No