Getting Started: Spotlight Searches

If you have used your Mac for even one day, you’ve probably asked yourself this question: How the heck do I find my own files? You could remember where you’ve put everything, but not only is that unlikely, but it’s not very efficient. We use so many programs today, from web browsers and email clients, to address books and calendars, word processing to PDF readers. It’s easy to care about the name of a file and its location when you only have one or two of them, but when you’ve received hundreds of work email, dozens of PDFs to proofread, and have thirteen cover letters to sift through, you want to know what’s inside them. Mac OS X’s Spotlight can help you find everything you’re looking for, and it is very fast.

What is Spotlight?

Simply put, Spotlight is Apple’s search technology. It has been included in Mac OS X since 10.4 Tiger, and 10.5 Leopard has improved both the speed and functionality of the technology. Spotlight is not a program that you open, use, and then quit. Rather, the technology is constantly running in the background in order to allow you to search files immediately after creating or downloading them. Spotlight runs an invisible application called “mds” which means “metadata server.” Think of mds as an extremely hard-working PhD student who memorizes everything she can read. Whenever a file is created, added, or modified on your system, Spotlight is notified of this and re-reads the file to learn what is in it.

Spotlight creates an invisible database on your computer that keeps track of everything it reads, and this is the secret to why Spotlight is so fast: whenever you search for something, Spotlight has already indexed your information and knows where your data is. It doesn’t have to scan all of your files every time you want to find something.

The Basics of Spotlight Searching

Searching with Spotlight is very easy. You do not need to change any settings or turn anything on. Spotlight has already searched your entire computer. To use Spotlight, all you need to do is click the magnifying glass in the upper-right corner of your menu bar (it’s always there, ready to go), type what you want, and Spotlight will return your results (by default, Spotlight also has a key command to open its search box, which is command-space bar). Here’s what a basic search for the word “imac” looks like on my computer:

use spotlight search

As you can see, Spotlight has returned many results. It is showing me that there are a bunch of emails that have that word, one PDF, some web pages I have visited that have the word, as well as a dictionary definition. Of course, it’s not going to show what is contained in each of those documents, so I can click on any one of them, and they will open up for me to inspect. You can see that the first line below the search field says, “Show All,” which, if clicked, will open a separate search window in the Finder containing a list of all the search results, not just the top 20 that were displayed here. We’ll talk more about the search window in just a minute.

Spotlight Search Terms

My example above only included one word: imac. You can make your searches quite a bit more specific, if you like. Here are a list of things you should consider when doing searches:

  • You can type any word(s) you want in the search box. Capitalization does not affect the search results, so “imac” produces the same results as “iMac.”
  • If you type multiple words in the search field, Spotlight assumes you want to find items that contain ALL of the words but not necessarily in that order. Thus, typing imac apple order finds documents that contain all three of those words, but the words can appear by themselves anywhere in the document.
  • If you want to force Spotlight to search for a string of words together, you put double quotation marks around them. For example, “apple store” only returns results where the word apple is directly followed by the word store (and, more precisely, that the two words are separated by one space).
  • You can also search by using the word or. If you type the search phrase imac OR macbook, Spotlight will find documents that contain the word imac or the word macbook but not both. This is a good way to isolate words.
  • You can tell Spotlight to look for one word and exclude another by separating them with the word “not.” For example, if I type, imac not macbook, then Spotlight will only show me the results where documents contain the word imac but not the word macbook (anywhere in the document):

spotlight search term

  • Spotlight is not just about complicated searches. You could just as easily type the word “movies” in the search box, and Spotlight will find all the movies on your computer. You could type the words “last week” into the box, and it will show you everything you’ve added or changed on your computer in the last week. Spotlight is pretty smart!

What Will Spotlight Search?

Just to show you how robust Spotlight is, this is a very incomplete list of what Spotlight will search: basic text documents, names and addresses (from your Address Book or Entourage), your emails, the names of files and folders, the names of your applications, iCal (or Entourage) events and tasks, system preferences, web pages you’ve visited and are in your history or bookmarked (only in Leopard), Word, Excel, and PowerPoint files; Pages, Keynote, and Numbers files; the names of your images, PDFs, the names and metadata in your iTunes music and your movies, and even the names of your fonts.

What is Metadata?

Now that I’ve written twice about metadata, I’ll just explain it a little bit. Apple’s own Dictionary describes metadata as, “A set of data that describes and gives information about other data.” That’s actually a good description. What does it really mean? Let’s say you have two songs in your iTunes library. One is called, “My Song” by Band A, and the other is called, “Your Song” by Band B. One of them was purchased from the iTunes Store, and the other was imported from a CD. You already know that you could search for the name of the song or the band name in Spotlight, but you could search for many other things, such as the type of media the song is and its bit rate. For example, some songs might have have bit rates of 256 whereas others have 128. If you only wanted to search for the lower bit rate songs 9which don’t sound as good), you can do that, even though you don’t know the name or contents of the songs.

There are more recognizable types of metadata, such as comments. You can have comments in Word files, PDFs, iCal events, and many other documents or data. I often put street addresses in the Notes field in my iCal events. If I remember that I went to some meeting on Main St. two months ago, but I can’t remember when or for what purpose I went, I could still search “Main St.” in Spotlight, and it would show me the iCal events with Main St. in the Notes field.

Performing More Targeted Searches

I mentioned clicking on the “Show All” line in the Spotlight search window several paragraphs ago. When you do, you get a separate search window with all of your results in the Finder. This window can be customized to do more targeted searches. In fact, it’s the same window you would get if you tried to do a search the old-fashioned way (going to the File menu in the Finder and clicking “Find”). Here’s what that search window looks like”

Targeted Search

This window shows the search results from my entry of “imac NOT macbook.” As you can see, there are 113 results (93 more than the Spotlight box can show). I’ve circled two areas on the window that are worth exploring. First, you see the tabs, “This Mac,” “Applications,” and, “Shared.” You can click on those to change the location of where Spotlight is searching. Searching “This Mac” means Spotlight will look everywhere, whereas “Applications” means Spotlight will only look in the Applications folder.

The second set of tabs has “Contents” and “File Name.” Here, you can allow Spotlight to search inside of files by clicking “Contents” (this is the default selection) or limit Spotlight to file names only, if you prefer. Before Mac OS X 10.4 came out with Spotlight, you could search the contents of files, but it took a long time, so many Mac users still prefer to search by file name instead. Of course, this is only helpful if you think you know the name of the file!

Finally, I’ve circled the “+” button. If you click the plus button, you can add additional criteria to your searches, such as as file kind, creation/application/open date, color, or hundreds of other criteria. Here’s what that basic window looks like:

spotlight search filter

Once I clicked the plus button, I received an additional line of options (via this pop-up menu). The items you see listed are my default list, and you can add others to your list by clicking the “Other” line and adding criteria from the box that pops up. I won’t go into it further, but the large list of choices you get contains various types of metadata.

Limiting What Spotlight Looks For

Spotlight, like most Apple technologies, has its own system preference. You can do three things in the system preference: change which types of files Spotlight will search (and in which order to display the results), change the keyboard shortcuts for Spotlight, and choose folders/files to exclude from Spotlight results. Here’s what the system preference looks like:

spotlight system preference

In the Search Results tab, by default, everything is selected, allowing Spotlight to maximize its search results. If you don’t want Spotlight to search through your web history, uncheck #10: Webpages. Or, if you want Spotlight to show you web pages first (giving them the highest priority), drag #10 above #1 to change its placement in the search results.

At the bottom of the window, you can turn on/off keyboard shortcuts and change which keys you press to activate them.

On the Privacy tab, you can click the plus button to add folders that you do not want Spotlight to search. If you add folders, then no items from those folders will ever be displayed as Spotlight search results (of course, you can remove those folders from the prohibited list at any time).

Final Thoughts

I hope this introduction to Spotlight helps you to more easily search for your files and data. Feel free to ask more questions, too. Remember that Spotlight cannot index absolutely everything. There may be file formats you rely on that can’t be indexed. With 3rd party software, it is up to the software developer to make applications compatible with Spotlight. Additionally, you can’t search for data that doesn’t exist. For example, if you have dozens of photos of your child in iPhoto, you can’t search for Mt. Rushmore and expect Spotlight to show you the photo of your child with Mt. Rushmore in the background. If, however, you had written the words “Mt. Rushmore” in the comments section of that photo, Spotlight could find it via metadata. Thus, while Spotlight is a wonderful tool, like all of us, it’s imperfect.

Did this article help you better understand Spotlight and how to perform searches on your Mac? Have you found better ways to search, or do you have tips to help make the process easier? Let others know inthe comments section.