let resultPageSize = results.pageSize; // 25
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.
let resultCount = results.totalCount; // 50
let resultPages = results.totalPages; // 2
Indicates if the search has another page of results.
function hasNext(): boolean;
let hasNext = results.hasNext(); // true
Indicates if the search has a previous page of results.
function hasPrev(): boolean;
let hasPrev = results.hasPrev(); // false
Retrieves the next page of search results.
The next()
function retrieves the next page of search 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.
If items are added or removed between calls to next()
, the values returned
by WixSearchResult
may change.
function next(): Promise<WixSearchResult>;
oldResults
.next()
.then((results) => {
let newResults = results;
let documents = newResults.documents;
let firstDocument = documents[0];
let facets = results.facets;
let totalCount = newResults.totalCount;
let pageSize = newResults.pageSize;
let currentPage = newResults.currentPage;
let totalPages = newResults.totalPages;
let hasNext = newResults.hasNext();
let hasPrev = newResults.hasPrev();
let length = newResults.length;
})
.catch((error) => {
console.log(error);
});