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:

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.

Method Declaration
Copy
Method Parameters
phrasestring

The phrase to run the search on.

Was this helpful?
Yes
No