search( )
Creates a search builder.
The search()
function builds a search for a site and returns
a WixSearchBuilder
object.
The returned object contains a search builder, which is used
to run the search with the find()
function.
Before running find()
, you can refine the search by chaining WixSearchBuilder
functions on to the search. WixSearchBuilder
functions enable you to filter, sort, apply facets,
and control the results a search returns.
search()
runs with the following WixSearchBuilder
defaults that you can override:
- documentType:
"Site/Pages"
- facets: none
- fuzzy:
true
- language: For multilingual sites, the current language. For single-language sites, the site language.
- limit:
25
- skip:
0
- searchFields: All searchable fields.
find()
returns results in the form of a WixSearchResult
, which
contains documents
that match the search, faceting and paging information,
and functions for paging through the search results.
search()
is not case sensitive.
If a search phrase
is not specified, search
returns all documents refined by the search builder.
You can leave out the search phrase if you want to filter, sort, and/or apply facets to your site content
without searching for a particular phrase.
The phrase to run the search on.