On the surface, searching with Spotlight is pretty straightforward. In my previous article, I explained how to perform basic searches, and how to access other Spotlight features. But if your search involves multiple terms, or if you need to narrow down your results to dig up a particularly elusive file, knowing how to put together a good search query will pay off.
By mastering a few simple tricks, such as using keywords to limit your search to specific dates, authors, or file types, you can narrow down your search to specific types of data, exclude terms, and more, helping Spotlight to locate exactly what you need.
Using the right words
If you search for just one word in Spotlight, the results are pretty simple. But if you search for more than one word, things get a bit more complex. Type time machine in the Spotlight search menu, and you'll get a list of every file containing both words.
Every Spotlight query is an AND search by default. This means the program looks for files containing all the words you type. This search will turn up any files that mention Yosemite's Time Machine backup feature, but also an IMDB search result for a movie of that name, a Wikipedia article on time travel, an article I wrote a few years ago about using the command line to control Time Machine, but it may also find an email from a friend discussing the best time to swing by and fix a machine.
You can narrow down the search results by using quotation marks; this tells Spotlight that the words must appear next to one another. If you type "time machine" Spotlight will look only for files that contain the exact phrase that you've typed inside the quotation marks. It will find Time Machine.doc and any file containing the term "time machine" but it will skip over your presentation on the evolution of machines through time. You don't even have to use both quotation marks; typing only the first one tells Spotlight that the words following it must appear together.
Use Boolean searching
Spotlight also supports true Boolean searching, which uses logical operators (AND, OR, and NOT) to pinpoint results.
For example, if you type "time machine" OR morlock, you'll get references to Yosemite's backup tool, as well as any files related to H. G. Wells's fictional species.
To find files that include time machine but make no mention of H. G. Wells, type "time machine" NOT Wells. When you perform a Boolean search, make sure to type operators in capital letters.
In addition to scouring your files' names and contents, Spotlight peruses metadata; file information generated by the program or device that created the file. For example, a digital photo's metadata may include information about the camera used to take the photo and about how the photo was taken: the camera type, focal length, color space, exposure time, and so on. If you want to find all photos taken with a certain camera, just enter its name or model number in the search field.
Sign up for CIO Asia eNewsletters.