Jacob D
08/09/2022, 5:58 PM.each()
to loop through the results just fine, but is there any way to result the number of results before/without looping through them? I’m migrating this script from SS 1.0 and previously, I was able to get the results all at once, parse the JSON and determine the length from there, but that doesn’t seem to be an option. Am I missing something?Marvin
08/09/2022, 6:02 PMcreece
08/09/2022, 6:04 PMconst MY_SEARCH = search.create({...}); // search.load whatever you need
const MY_SEARCH_RESULTS = MY_SEARCH.runPaged({
pageSize: 1000
});
MY_SEARCH_RESULTS.pageRanges.forEach(function(pageRange) {
MY_SEARCH_RESULTS.fetch({index: pageRange.index}).data.forEach(function(searchResult) {
// do whatever with search result
});
});
creece
08/09/2022, 6:04 PMMarvin
08/09/2022, 6:04 PMN/query
module as well. It provides a .runAsMapped()
method that turns into an object. Along with ability to do multiple joins.Marvin
08/09/2022, 6:07 PMcreece
08/09/2022, 6:10 PM