Introduction

When you execute a search with the find() function, it returns a Promise that resolves to a WixSearchResult object. This object contains the documents that match the search, faceting and paging information, and functions for paging through the search results.

Did this help?

currentPage


currentPagenumberRead-only

Returns the index of the current results page number.

The currentPage is a zero-based index of the current page of results.

The page size is defined by the limit() function, can be retrieved using the pageSize property. You navigate through pages using the prev() and next() functions.

The currentPage property returns undefined if the search returned no results.

JavaScript
Did this help?

documents


documentsArray<Document>Read-only

Returns the documents that match the search.

The current page of documents retrieved by the search.

The properties included in the search result documents array depend on the documentType specified for the search. If the documentType is set to Site/Pages, only the default document properties listed below are returned.

If the documentType is set to a specific Wix app collection (such as "Stores/Products"), the returned search result documents contain additional fields. The fields included in the returned documents are different for each documentType. To view the search schema for each document type, see the following articles:

The search result page size is defined by the limit() function, can be retrieved using the pageSize property, and navigating through pages is done with the prev() and next() functions.

When no documents match the search, the documents array is empty.

JavaScript
Did this help?

facets


facetsArray<FacetResult>Read-only

Returns the facet results retrieved by the search.

The facet results provide grouping information for documents returned by the search, based on the requested facets.

Facet results are structured as follows:

Each facet specified in the facets() function returns a single facet result. Each facet result includes a facet group containing the name of the specified facet and an array of facets listing the number of documents matching each facet value.

The following example shows the facet results for a store product search for which collections and onSale were specified as facets:

"facets": [ { "facet": "collections", "facets": [ { "facetValue": "Boots", "count": 13 }, { "facetValue": "Running Shoes", "count": 22 }, { "facetValue": "Sandals", "count": 18 } ] }, { "facet": "onSale", "facets": [ { "facetValue": "true", "count": 17 }, { "facetValue": "false", "count": 36 } ] } ]

When no facets are specified in the facets() function, the returned facets array is empty.

JavaScript
Did this help?

length


lengthnumberRead-only

Returns the number of documents in the current results page.

The length is the number of documents in the current page. This may be different than the pageSize, which is defined by the limit() function.

You navigate through pages using the prev() and next() functions.

JavaScript
Did this help?

pageSize


pageSizenumberRead-only

Returns the search page size.

The page size is defined by the limit() function, can be retrieved using the pageSize property. You navigate through pages using the prev() and next() functions.

JavaScript
Did this help?

totalCount


totalCountnumberRead-only

Returns the total number of documents that match the search.

The totalCount returns the total number of documents that match the search, not just the number of documents in the current page.

JavaScript
Did this help?

totalPages


totalPagesnumberRead-only

Returns the total number of pages the search produced.

The page size is defined by the limit() function, can be retrieved using the pageSize property. You navigate through pages using the prev() and next() functions.

JavaScript
Did this help?

hasNext( )


Indicates if the search has another page of results.

Method Declaration
Copy
function hasNext(): boolean;
Request
This method does not take any parameters
Returns
Return Type:boolean
JavaScript
let hasNext = results.hasNext(); // true
Did this help?