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:

  1. Create a WixSearchFilterBuilder using the filter() function.
  2. Create a WixSearchFilter by chaining a single WixSearchFilterBuilder filtering function, such as eq() or gt(), to the filter builder. You cannot chain more than 1 filtering function to a WixSearchFilterBuilder.
  3. Do one of the following:
  • Create more filters: Pass one or more WixSearchFilters as parameters to an and(), or(), or not() WixSearchFilterBuilder function to create a new WixSearchFilter. For example, newFilter = wixSearch.filter().or(filter1, filter2).
  • Refine a search: Pass one or more WixSearchFilters as parameters to an and(), or(), or not() WixSearchBuilder function to refine a search. For example, newSearchBuilder =, filter2).

Note that only some fields can be filtered. Check which fields can be filtered in the supported schemas for each documentType.

Method Declaration
This method does not take any parameters
Was this helpful?