Has anyone else ran into this? We've had a ticket open with NetSuite for a long time and I'm surprised I can't seem to find anyone else talking about the issue.
When we run saved searches in code we usually use a pattern that allows for more than 1000 rows. What we've discovered is that this results in some of the rows not being returned... sometimes :-(. We've duplicated the issue in 1.0 and 2.0. It seems to only happen on saved searches that have less than 1000 results and more than 150(ish). I also think we've only ran into it when searching the item record.
Here's some 1.0 code that demos the issue. The nlapiSearchRecord will return the correct number of results, the slice version will be missing rows (sometimes).
var savedSearchId = 1228;
var x = getSearchResults(null, savedSearchId);
nlapiLogExecution('DEBUG', 'Search results 1', x.length)
var y = nlapiSearchRecord(null, savedSearchId);
nlapiLogExecution('DEBUG', 'Search results 2', y.length)
var stop = 'here';
function getSearchResults(recordType, searchId) {
var savedSearch = nlapiLoadSearch(recordType, searchId);
var resultset = savedSearch.runSearch();
var returnSearchResults = [];
var searchid = 0;
do {
var resultslice = resultset.getResults(searchid, searchid + 1000);
for ( var rs in resultslice) {
returnSearchResults.push(resultslice[rs]);
searchid++;
}
} while (resultslice.length >= 1000);
return returnSearchResults;
}