Find Files with Spotlight
Spotlight is wired deep into Mac OS X and 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 displaying a pulsating dot, which indicates Spotlight is indexing new material.
Perform a Spotlight search
There are two entry points for Spotlight in the Finder: the Spotlight icon at the far right edge of 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.
- 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 often you can just start typing and press Return to jump to the item.
Figure 4.7 A Spotlight search from the menu bar
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.8). 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.
- To further narrow the search, click the plus sign (+) icon on the search bar to apply additional criteria (Figure 4.9).
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.
Figure 4.8 A Spotlight search in a Finder window
Figure 4.9 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.
- Open the Spotlight preference pane in System Preferences.
- Click the Privacy button.
- Drag the folder or hard disk to the list area (Figure 4.10). Or, click the Add (+) button below the list and locate the item to exclude.
Figure 4.10 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.11).
Figure 4.11 Creating a Smart Folder
- Choose File > New Smart Folder to open a new Finder window with the search criteria enabled.
- Set the Kind attribute to Document.
- Click the plus sign (+) to add a new attribute.
- 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 Lion’s Saved Searches folder). Make sure the Add To Sidebar checkbox is enabled 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.