Find Files with Spotlight
Spotlight is wired deep into OS X and is used by applications such as Mail and the built-in Help system. Whenever you save a change to a document, Spotlight updates its index in the background.
You don’t need to do anything to activate Spotlight; it’s just there. Occasionally you may notice the Spotlight icon (in the right corner of the menu bar) displaying a pulsating dot, which indicates that Spotlight is indexing new material.
Perform a Spotlight search
There are two entry points for Spotlight in the Finder: the Spotlight icon on the menu bar (which is available in all applications) and the Search field in a window’s toolbar.
Search from the Spotlight menu
The idea behind Spotlight is that it’s quick and unobtrusive. The Spotlight icon in the menu bar is my first stop for searching.
- Click the Spotlight icon or press Command-spacebar.
- Start typing what you’re looking for. Spotlight begins to display results as you type.
Figure 4.8. A Spotlight search from the menu bar
- If you see what you’re looking for, click its name to open it (or use the arrow keys to select it and press Return). The Top Hit is always automatically selected, so you can often just start typing and press Return to jump to the item.
If you don’t spot a match, click or select Show All in Finder to view the results in a Finder window (see the next section).
Search within a Finder window
Performing a search within a Finder window gives you more options—and more results—than the menu bar.
- In any Finder window, enter your search term in the Search field. Or, choose File > Find to activate the Search field in the active window (or to open a new window if one wasn’t already open). As with the menu bar, results begin to appear as soon as you start typing.
- Narrow your search, if necessary, by specifying additional search criteria (Figure 4.9). Click This Mac to search the entire computer; click “folder name” to limit the search to just the active folder; or click Shared to scan shared disks and connected network volumes.
Figure 4.9. A Spotlight search in a Finder window
Normally a search looks through the contents of all indexable files on your computer, but you can limit the query to just file and folder names by choosing the “Filename contains” item from the menu that appears as you type.
- To further narrow the search, click the plus sign (+) icon on the search bar to apply additional criteria (Figure 4.10).
Figure 4.10. Use search criteria to narrow the list.
Hide data from Spotlight
Spotlight builds its index from everything on your hard disk, but you may want to exclude data such as personal correspondence or financial documents from casual searches. Or, you may have a secondary hard disk being used as a scratch disk to shuttle temporary files for an application like Photoshop or Final Cut Pro.
- Open the Spotlight preference pane in System Preferences.
- Click the Privacy button.
- Drag the folder or hard disk to the list area (Figure 4.11). Or, click the Add (+) button below the list and locate the item to exclude.
Figure 4.11. Exclude data from Spotlight’s bright glare.
Here’s where you can really get productive. Not only can you perform searches using multiple criteria, but that search can be saved as a Smart Folder whose contents are updated depending on the search. For example, here’s how to set up a Smart Folder that displays documents created in the last week (Figure 4.12).
Figure 4.12. Creating a Smart Folder
- Choose File > New Smart Folder to open a new Finder window with the search criteria enabled.
- Click the plus sign (+) to add a new attribute.
- Set the Kind attribute to Document.
- Click the plus sign (+) again.
- Set that attribute’s first pop-up menu to “Created date,” and specify that it is within the last 7 days.
- Click the Save button to save the Smart Folder. Give it a name (and, optionally, a location if you want it somewhere other than Mountain Lion’s Saved Searches folder). Make sure the Add To Sidebar checkbox is selected if you want it to appear in the sidebar.
No documents are actually stored in a Smart Folder. Instead, it acts as a portal that filters just the files you want to see, updated live.