How does the search capability work?

We search for File Name, Email Sender Name and Email Subject and show those in the search results. For files we search for attributes like File Name, Folder, and Author.