If search results were generated by a search, TotalFiles will contain the number of documents retrieved in the search, including documents that were not retained in the SearchResults object due to the MaxFilesToRetreive limit.
If search results were generated in any other way, such as through the unionWith or intersectionOf operations, then TotalFiles will be the number of documents actually stored in search results.