var dupFoundset = controller.duplicateFoundSet(); //copiesyour currentFoundset into a variable
controller.find();
//do search
if(!controller.search() ) // performs the search AND checks if result is empty
{
plugins.dialogs.showDialog('Alert','No searchResults','OK')
controller.loadRecords(dupFoundset)//restores your prev set.
}