According to Search limits for SharePoint Online SharePoint Online search has the following limit:
Limit: Number of rows in a result set
Maximum value: 500
Limit type: Boundary(*)
Notes: To display the entire result set, issue more paging queries
Boundary - A number that can’t be exceeded
Since 500 RowLimit
cant be exceeded you could consider the following approach to return all search results. The idea is to perform queries until all search results will be returned, for that purpose we will utilize RowLimit
and StartRow
query parameters.
function search(webUrl,queryText,rowLimit,startRow,allResults)
{
var allResults = allResults || [];
var url = webUrl + "/_api/search/query?querytext='" + queryText + "'&rowlimit=" + rowLimit + "'&startrow=" + startRow;
return $.getJSON(url).then(function(data) {
var relevantResults = data.PrimaryQueryResult.RelevantResults;
allResults = allResults.concat(relevantResults.Table.Rows);
if (relevantResults.TotalRows > startRow + relevantResults.RowCount) {
return search(webUrl,queryText,rowLimit,startRow+relevantResults.RowCount,allResults);
}
return allResults;
});
}
Usage
search(_spPageContextInfo.webAbsoluteUrl,'sharepoint',500,0)
.done(function(results){
for(var i = 0;i < results.length;i++){
console.log(results[i].Cells[3].Value);
}
});
References
SharePoint Search REST API overview