Updated the search results getattr function to work with hasattr for keys that do not exist