I am in the works of writing a combination of Suitelet calling a RESTlet which will return the results of a search. I have attempted this in SS 1.0 and now in SS 2.0 and continue to have the same issue. In the UI I can display 1000 search results in less than 4 seconds. When attempting to 'get' these sames results via code it takes nearly 30 seconds, longer for each iteration. The code is pretty simple. It accepts a search.Search object from another function and returns the full result set. It does this by getting the results 1000 at a time and concatenating them together. So far in my testing it appears to timeout at roughly 11000 results. The search I am testing with is a Time Entry search, contains no joins, and has 15 columns. It appears based on testing that each time the getRange() is called with a new start and end it takes longer and longer. Anyone else experience this or have a workaround?
function getFullResultSet(search) { //search is the search.Search object var tempResults, resultSet, results = null, lastIndex = 0; resultSet = search.run(); do { tempResults = resultSet.getRange({ start: lastIndex, end: lastIndex + 1000 }); if (tempResults) { if (!results) { results = []; } results = results.concat(tempResults); lastIndex += 1000; } } while (tempResults && tempResults.length === 1000); return results; }