Search...
hasNext( )
Indicates if the search has another page of results.
Syntax
function hasNext(): boolean
hasNext Parameters
This function does not take any parameters.
Returns
true
if there are more results.
Return Type:
boolean
Was this helpful?
Get whether the search result object has more results
Copy Code
1let hasNext = results.hasNext(); // true
Iterate through all pages of search results
This example demonstrates how to get all search results, bypassing the maximum limit of 1000.
Copy Code
1async function retrieveAllDocuments(phrase){2 let allDocuments = [];34 let results = await wixSearch.search(phrase)5 .limit(1000)6 .find();78 allDocuments.push(results.documents);910 while(results.hasNext()) {11 results = await results.next();12 allDocuments.push(results.documents);13 }1415 return allDocuments;16}