The WixSearchBuilder
functions enable you to run, filter, sort, apply facets (categorize), and control
which results a search returns.
Typically, you build a search using the search()
function,
refine the search by chaining WixSearchBuilder
functions, and then execute the
search by chaining a find()
function.
For example, the following searches a site for all store products containing the phrase "shoe" in English that are on sale, sorts them alphabetically according to their SKU, and logs the first 5 results to the console:
1
Only some fields can be searched, filtered, sorted, or faceted. Check the supported schemas for each documentType
:
To use the and()
, or()
, and not()
filtering functions, you first need to create
WixSearchFilters
using the filter()
function
and the WixSearchFilterBuilder
filtering functions. You can then
pass the WixSearchFilters
to the and()
, or()
, and not()
functions.
Note that when you chain multiple filtering functions to a WixSearchBuilder
, an and
condition is assumed.