Rob
10/08/2024, 6:02 PMCeligo AI
10/08/2024, 6:02 PMAI generated answer (using internal Slack threads):To run a query that has more than 5000 results using n/query, you can use the
runPaged()
method. This method allows you to get pages of results that would exceed the normal limit of query.run()
. Here is an example of how you can use it:
javascript
function getAllQueryResults(rootQuery) {
var pagedData = rootQuery.runPaged({ pageSize : 1000 });
var queryData = [];
for (var i = 0; i < pagedData.pageRanges.length; i++) {
var currentPage = pagedData.fetch({ index : i });
var currentPagedData = currentPage.data;
var results = currentPagedData.results;
for (var j = 0; j < results.length; j++) {
queryData.push(results[j].asMap());
}
}
return queryData;
}
In this example, the runPaged()
method is used to fetch 1000 results per page. The pageRanges
property of the pagedData
object is used to iterate over the pages. For each page, the fetch()
method is used to get the current page, and the data
property of the currentPage
object is used to get the current paged data. The results
property of the currentPagedData
object is used to get the results for the current page, which are then added to the queryData
array.
Please note that the pageSize
parameter in the runPaged()
method determines the number of results per page, and it can be set to a maximum of 1000.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
10/08/2024, 6:03 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.86882174
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.854461551
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.838217556
Celigo AI
10/08/2024, 6:03 PM