Spotlight is a technology for tracking files in terms of their features. These features of a file are called its
, and they include all sorts of information about the file: its name, its creation and modification date, its size, its contents, and so forth. Different kinds of files provide different kinds of metadata: for example, a word processing file has text contents, but an image file has a two-dimensional size, a resolution, and a color profile.
Spotlight knows how to extract metadata from many types of file; furthermore, any application can provide metadata information about whatever types of file are special to it, and Apple’s own applications, such as iCal, Mail, and Address Book, already do this. An unrestricted Spotlight search embraces all the kinds of metadata; a search on “rock” might find applications with “rock” in their name, word processing files with “rock” in their contents, iPhoto images with “rock” as a keyword, and MP3 music files with “rock” as their genre.
Note: As you experiment with Tiger, you’ll discover that Apple has modified some of its applications to allow you specify certain kinds of metadata. For example, user comments in a file’s Get Info window in the Finder are now called Spotlight Comments, and a TextEdit document now has Document Properties, such as an Author (choose File: Show Properties in TextEdit to see them). All of that is so this information can be found through Spotlight.
On the whole, you won’t be aware that Spotlight is present until you need it. After you first install Tiger, you may notice background disk activity, along with a subtle “throbbing” of the Spotlight menu icon, as Spotlight constructs an initial index of the metadata of all the files on your hard disk; this can take quite a long time (several hours). But after that, Spotlight becomes more or less invisible: the index is updated live each time you save or move a file (this happens so quickly that you probably won’t be aware of it). Thus, whenever you do a Spotlight search, it is usually rapid and completely up-to-date.
By now you’re probably chomping at the bit, eager to stop reading about Spotlight and to try it. Before we do that, here are some additional cool facts about Spotlight to get you drooling even more:
It’s live: If the results of a Spotlight search are open, and if the situation on the hard disk changes—you download some files from the Internet, for example—the results of the search will change immediately to take those changes into account.
It’s everywhere: When you perform a local (non-Internet) search in any Apple application, you’re probably using Spotlight. The search field in the System Preferences window, the search field in a Finder window, the search field in the Mail window—they’re all Spotlight. As Tiger matures, third-party developers will add Spotlight searching to their applications as well.
It’s persistent: A Spotlight search can be saved, and various Apple applications provide a way to do this. The Finder gives you Smart Folders (which I talk about more in a moment); Mail gives you Smart Mailboxes; Address Book gives you Smart Groups. Because a Spotlight search is live, any time you open a Smart Folder or a Smart Mailbox, it updates immediately.
Set Up Spotlight Preferences
To set up Spotlight preferences, use the Spotlight preference pane. What you determine here will make much more sense once you’ve looked at how you actually interact with Spotlight.
At system level, there are two ways to perform a Spotlight search and view the results: the Spotlight menu (top screenshot) and the Spotlight window (bottom screenshot).
Your first task in the Spotlight preference pane is to
set the keyboard shortcuts
for summoning the Spotlight menu and the Spotlight window. You
summon the Spotlight menu or window
a keyboard shortcut: summon the menu by clicking the Spotlight icon at the right end of the menu bar. This will also bring the Spotlight window to the front if it is already open; if it isn’t already open, you can summon it from the menu by doing a search in the menu’s search field and then choosing Show All (the first item in the menu).
Still, the keyboard shortcuts are very convenient, and they allow you to search without taking your hands off the keyboard. So I recommend that you take these shortcuts seriously, because you’ll use them a lot if you’re to be a Tiger power user.
Tip: In the Spotlight preference pane, you are not limited to the suggested keyboard shortcuts that appear in the pop-up menus (Command-Space, Command-Option-Space, and the F-keys); you can click in a shortcut text field and enter
keyboard shortcut. Be sure to choose a shortcut that won’t conflict with another global keyboard shortcut, taking third-party utilities into account; for example, LaunchBar wants to use Command-Space by default.
Now we can talk about
how search results are presented
. In the Spotlight menu, and also in the Spotlight window when results are grouped by kind, results are clumped into categories. What categories are shown, and in what order, is determined by your settings in the Spotlight system preferences, in the Search Results pane.
You can uncheck a category to keep results that fall into that category from showing up at all, and you can rearrange the list of categories using drag-and-drop to determine the order when results are grouped by kind. These settings affect search results immediately; for example, if the Spotlight window is open and you change the settings in the Spotlight preference pane, the display of the results in the Spotlight search window will change in response.
Finally, it’s time to tell Spotlight where it should
look, and you do this in the Privacy pane of the Spotlight system preferences. Spotlight will not dive into areas where you would be forbidden by user permissions (such as another user’s Documents folder); but you might have a reason for excluding further areas from being part of a search—for instance, a certain folder might contain only old stuff you never want searched. Drag a folder from the Finder into the list here, or use the plus-button, and Spotlight will exclude the contents of that folder (and all folders inside that folder, and so forth) from searches. In fact, when you do this, you might hear the hard disk working for a while; that’s Spotlight removing from its index the metadata for everything inside the specified folder.
Tip: But what about the opposite of privacy? What if there’s an area of your hard disk that you’d like Spotlight to include in its searches, but it doesn’t, even though permissions give you access to that area? (The top-level Developer folder, created when you install the Developer Tools, seems to be such an area; some hidden rule apparently prevents Spotlight from indexing it.) Using Terminal, you can force Spotlight to index a directory. At the prompt, type this, substituting the actual pathname of a directory (and press Return):
mdimport -f /path/to/directory
Use Spotlight Efficiently
This ebook is about how to customize Tiger, not how to use it; so I won’t give complete instructions on how to work with Spotlight. However, you won’t be happy with Spotlight if you don’t use it efficiently, so here are some recommendations for getting the most out it:
Remember to use Spotlight: I know it sounds obvious, but you’re not going to get anything out of Spotlight if you forget to use it! You need to get into the habit of accessing things by their names (or any other metadata search criteria).
Let’s say you want to use TextEdit. Don’t bother navigating to the Applications folder; simply summon the Spotlight menu, type
, and there’s TextEdit listed, ready for you to open it. Or suppose you want the Startup Disk preference pane. You could open System Preferences, find the Startup Disk icon, and click it; but instead, summon the Spotlight menu and type
. The Startup Disk preference pane is probably the first choice listed; select it, and bingo, you’re there. And, if
is one of your Safari bookmarks and you feel like reading this week’s issue, there’s no need to open Safari first: summon the Spotlight menu and type
; there’s the bookmark, and now you can go to it instantly.
Remember the Spotlight window: The Spotlight menu is tempting, because the icon is always present at the right end of the menu bar; but you can see only a few results here, and you can’t get any information about those results. To see all results, or to get more information, you must use the Spotlight window.
Keep your hands on the keyboard: To see what I mean, let’s use the Spotlight window. Type the Spotlight window keyboard shortcut that you set up in the previous section. The window has a search field. Don’t click the mouse in it; there’s no need! The search field already has the focus, so just start typing your search. The search is live, so there’s no need to press Return. Now, try these shortcuts:
Change the search by starting over from scratch: Esc key.
Move the focus from the search field to the list of results: Tab key. (You can also press the Tab key again to navigate the list of options at the right side of the window—Group by Kind, Group by Date, and so on. To choose the currently selected option, press Spacebar. To get out of the list of options, keep pressing Tab until you reach the last option, and then press Tab once more to return to the search field.)
Navigate up and down in the list of results: Up- and Down-arrow keys.
Show and hide info about a selected result: Right- and Left-arrow keys. Add the Option key to the Right- and Left-arrow keys to show and hide information for
the results in the current category.
See Finder info on the selected item: Command-I.
View the selected item in the Finder: Command-R.
Open the selected item: Command-O or Command-Down-arrow.
Note: The Spotlight window sometimes displays only the first five entries in a category. I don’t know a way to change this number, and I don’t know how to see all the entries in a category without using the mouse.
The Spotlight menu and the Spotlight window are both system-level ways of accessing Spotlight: you can reach them no matter what application is frontmost. But the Finder also provides a mode of Spotlight access through a search field in the toolbar of a Finder window.
A Finder Spotlight search is more restricted than a global Spotlight search: in the Finder, the only things you can search for are files and folders. That’s not much of a restriction, since files and folders are the most common things to search for; but it’s a restriction nonetheless. (For example, in a system-wide Spotlight search, you can find e-mail messages, thanks to metadata from Mail, and calendar events, thanks to metadata from iCal; you can’t do that in a Finder search.)
On the other hand, the Finder’s interface to Spotlight is better, in certain ways, than either the Spotlight menu or the Spotlight window. Plus, a Spotlight search in the Finder can be saved as a Smart Folder, a cool new feature of Tiger that I recommend you start using.
Let’s look at how the Finder’s Spotlight interface works. To see it, switch to the Finder and press Command-F to switch the focus to the search field, so you can type a search term. Alternatively, just click in the search field of a Finder window and start typing. Either way, the search begins immediately (there is no need to press Return), and you are now looking at a Finder search window. (Exactly what you see depends on whether you were already in a Finder window and whether the toolbar is displayed, but the window will probably look roughly like the screenshot below.)
The Finder search window can’t be as fully navigated with the keyboard as the Spotlight window, and, oddly, it ignores your category settings from the Spotlight preference pane. However, it does offer some nice advantages:
You can limit the search to specific folder(s): If the desired folder doesn’t appear in the bar immediately below the search field, click Others.
You can use multiple criteria: Criteria that you add by clicking the plus-button, at the right end of a row, will filter the search you initiated in the search field. (If you want
your added criteria to be operative, leave the search field blank.)
You can change your view: Use the tripartite widget in the toolbar, or choose from the View menu. You can customize the settings for these views, much as for a normal Finder window, by choosing View: Show View Options (Command-J).
You can work with the path: As you select a result, its path—the hierarchy of files containing it—is displayed at the bottom of the window. You can open any folder in the path by double-clicking it. (If the path is long, the names of the containing folders will be curtailed, but each folder reveals its full name as you pass the mouse over it.)
You can do normal Finder operations: You can perform certain ordinary Finder operations on a found file—rename it, reveal it, show its Get Info window, label it, trash it, or open it. (Control-click a file to quickly access these functions.)
Tip; In a criterion filter, choose Other from the first pop-up menu to see a dialog listing all the kinds of Spotlight metadata for all the file types on your computer.
Make Smart Folders
is a saved Finder search. You can also think of it as a saved Finder search
, because it retains all its settings (the view, the column widths if you’re in list view, and so forth), and displays the search results. These results are always current (because Spotlight searches are live). Thus, a Smart Folder always effectively “contains” the files that match the folder’s search criteria at
any given moment
. Not everyone needs Smart Folders, but if you do, then once you’ve made a few, you’ll wonder how you lived without them.
To make a Smart Folder, press the Save button that appears at the upper right of a Finder search window. (In the screenshot higher up on this page, the Save button is visible in the top row, after the list of locations to search.) You’re offered a chance to save to the Saved Searches folder (it’s in your Library), to the Desktop, or to your Home folder. These, oddly, are the only choices; however, you can move the Smart Folder anywhere you like after saving it.
A saved Smart Folder is indicated by a special icon, a folder with a gear on it. When you open that folder, the up-to-date search results appear. The Save button is now an Edit button; press it to display and to change the search criteria. To save the altered Smart Folder under a new name, hold the Option key; the Save button changes to Save As.
For example, sometimes I get bored with my Desktop background, and I like to change it. I have a big monitor, so I like to use only high-quality images—meaning big images, those whose pixel dimensions are large. What are the largest JPEGs on my computer? To find out, I can do a Finder search. Having performed the search, I then click the Save button to make Smart Folder.
Now I have a Smart Folder that permanently presents me with all my highest-quality images, no matter where on my hard disk they may be located. In the blink of an eye, I’ve sliced through the folder hierarchy to create a collection of files based not on their location but on their characteristics.
EDITOR’S NOTE: This excerpt was updated on May 20 to remove an example about using a Spotlight search to collect cache files since that example does not work in the currently shipping version of OS X 10.4. This change will be reflected in a future edition of
Take Control of Customizing Tiger
, which will be a free update to anyone who bought the ebook.