Chapter 3. Spotlight

Every computer offers a way to find files. And every system offers several different ways to open them. But Spotlight, a star feature of Mac OS X (and touched up in Snow Leopard), combines these two functions in a way that’s so fast, so efficient, so spectacular, it reduces much of what you’ve read in the previous chapters to irrelevance.

That may sound like breathless hype, but wait till you try it. You’ll see.

See the little magnifying-glass icon in your menu bar ()? That’s the mouse-driven way to open the Spotlight Search box.

The other way is to press ⌘-space bar. If you can memorize only one keystroke on your Mac, that’s the one to learn. It works both at the desktop and in other programs.

In any case, the Spotlight text box appears just below your menu bar (Figure 3-1).

Begin typing to identify what you want to find and open. For example, if you’re trying to find a file called Pokémon Fantasy League.doc, typing just pok or leag would probably suffice. (The Search box doesn’t find text in the middles of words, though; it searches from the beginnings of words.)

A menu immediately appears below the Search box, listing everything Spotlight can find containing what you’ve typed so far. (This is a live, interactive search; that is, Spotlight modifies the menu of search results as you type.) The menu lists every file, folder, program, email message, Address Book entry, calendar appointment, picture, movie, PDF document, music file, Web bookmark, Microsoft Office (Word, Power-Point, Excel, Entourage) document, System Preferences panel, To Do item, chat transcript, Web site in your History list, and even font that contains what you typed, regardless of its name or folder location.

If you see the icon you were hoping to dig up, just click it to open it. Or use the arrow keys to “walk down” the menu, and then press Return or Enter to open the one you want.

If you click an application, it pops onto the screen. If you select a System Preferences panel, System Preferences opens and presents that panel. If you choose an appointment, the iCal program opens, already set to the appropriate day and time. Selecting an email message opens that message in Mail or Entourage. And so on.

Spotlight is so fast, it eliminates a lot of the folders-in-folders business that’s a side effect of modern computing. Why burrow around in folders when you can open any file or program with a couple of keystrokes?

It should be no surprise that a feature as important as Spotlight comes loaded with options, tips, and tricks. Here it is—the official, unexpurgated Spotlight Tip-O-Rama:

Most people just type the words they’re looking for into the Spotlight box. But if that’s all you type, you’re missing a lot of the fun.

You can confine your search to certain categories using a simple code. For example, to find all photos, type kind:image. If you’re looking for a presentation document but you’re not sure whether you used Keynote, iWork, or PowerPoint to create it, type kind:presentation into the box. And so on.

Here’s the complete list of kinds. Remember to precede each keyword type with kind and a colon.

To find this:

Use one of these keywords:

A program

app, application, applications

Someone in your Address Book

contact, contacts

A folder or disk

folder, folders

A message in Mail

email, emails, mail message, mail messages

An iCal appointment

event, events

An iCal task

to do, to dos, todo, todos

A graphic

image, images

A movie

movie, movies

A music file

music

An audio file

audio

A PDF file

pdf, pdfs

A System Preferences control

preferences, system preferences

A Safari bookmark

bookmark, bookmarks

A font

font, fonts

A presentation (PowerPoint, iWork)

presentation, presentations

You can combine these codes with the text you’re seeking, too. For example, if you’re pretty sure you had a photo called “Naked Mole-Rat,” you could cut directly to it by typing mole kind:images or kind:images mole. (The order doesn’t matter.)

If your brain is already on the verge of exploding, now might be a good time to take a break.

In Mac OS X 10.4, Spotlight could search on either of the criteria described above: kind or date.

But these days, you can limit Spotlight searches by any of the 125 different info-morsels that might be stored as part of the files on your Mac: author, audio bit rate, city, composer, camera model, pixel width, and so on. Other has a complete discussion of these so-called metadata types. (Metadata means “data about the data”—that is, descriptive info-bites about the files themselves.) Here are a few examples:

Now, those examples are just a few representative searches out of the dozens that Mac OS X makes available.

It turns out that the search criteria codes that you can type into the Spotlight box (author:casey, width:800, and so on) correspond to the master list that appears when you choose Other in the Spotlight window, as described on The Spotlight Window. In other words, there are 125 different search criteria.

There’s only one confusing part: In the Other list, lots of metadata types have spaces in their names. Pixel width, musical genre, phone number, and so on.

Yet you’re allowed to use only one word before the colon when you type a search into the Spotlight box. For example, even though pixel width is a metadata type, you have to use width: or pixelwidth: in your search.

So it would probably be helpful to have a master list of the one-word codes that Spotlight recognizes—the shorthand versions of the criteria described on Other.

Here it is, a Missing Manual exclusive, deep from within the bowels of Apple’s Spotlight department: the master list of one-word codes. (Note that some search criteria have several alternate one-word names.)

Real Search Attribute

One-Word Name(s)

Keywords

keyword

Title

title

Subject

subject, title

Theme

theme

Authors

author, from, with, by

Editors

editor

Projects

project

Where from

wherefrom

Comment

comment

Copyright

copyright

Producer

producer

Used dates

used, date

Last opened

lastused, date

Content created

contentcreated, created, date

Content modified

contentmodified, modified, date

Duration

duration, time

Item creation

itemcreated, created, date

Contact keywords

contactkeyword, keyword

Version

version

Pixel height

pixelheight, height

Pixel width

pixelwidth, width

Page height

pageheight

Page width

pagewidth

Color space

colorspace

Bits per sample

bitspersample, bps

Flash

flash

Focal length

focallength

Alpha channel

alpha

Device make (camera brand)

make

Device model (camera model)

model

ISO speed

iso

Orientation

orientation

Layers

layer

White balance

whitebalance

Aperture

aperture, fstop

Profile name

profile

Resolution width

widthdpi, dpi

Resolution height

heightdpi, dpi

Exposure mode

exposuremode

Exposure time

exposuretime, time

EXIF version

exifversion

Codecs

codec

Media types

mediatype

Streamable

streamable

Total bit rate

totalbitrate, bitrate

Video bit rate

videobitrate, bitrate

Audio bit rate

audiobitrate, bitrate

Delivery type

delivery

Altitude

altitude

Latitude

latitude

Longitude

longitude

Text content

intext

Display name

displayname, name

Red eye

redeye

Metering mode

meteringmode

Max aperture

maxaperture

FNumber

fnumber, fstop

Exposure program

exposureprogram

Exposure time

exposuretime, time

Headline

headline, title

Instructions

instructions

City

city

State or province

state, province

Country

country

Album

album, title

Sample rate

audiosamplerate, samplerate

Channel count

channels

Tempo

tempo

Key signature

keysignature, key

Time signature

timesignature

Audio encoding application

audioencodingapplication

Composer

composer, author, by

Lyricist

lyricist, author, by

Track number

tracknumber

Recording date

recordingdate, date

Musical genre

musicalgenre, genre

General MIDI sequence

ismidi

Recipients

recipient, to, with

Year recorded

yearrecorded, year

Organizations

organization

Languages

language

Rights

rights

Publishers

publisher

Contributors

contributor, by, author, with

Coverage

coverage

Description

description, comment

Identifier

id

Audiences

audience, to

Pages

pages

Security method

securitymethod

Content Creator

creator

Due date

duedate, date

Encoding software

encodingapplication

Rating

starrating

Phone number

phonenumber

Email addresses

email

Instant message addresses

imname

Kind

kind

URL

url

Recipient email addresses

email

Email addresses

email

Filename

filename

File pathname

path

Size

size

Created

created

Modified

modified

Owner

owner

Group

group

Stationery

stationery

File invisible

invisible

File label

label

Spotlight comments

spotlightcomment, comment

Fonts

font

Instrument category

instrumentcategory

Instrument name

instrumentname

As you may have noticed, the Spotlight menu doesn’t list every match on your hard drive. Unless you own one of those extremely rare 60-inch Apple Skyscraper Displays, there just isn’t room.

Instead, Spotlight uses some fancy behind-the-scenes analysis to calculate and display the 20 most likely matches for what you typed. But at the top of the menu, you usually see that there are many other possible matches; it says something like “Show All,” meaning that there are other candidates. (Mac OS X no longer tells you how many other results there are.)

There is, however, a second, more powerful way into the Spotlight labyrinth. And that’s to use the Spotlight window, shown in Figure 3-2.

When you’re in the Finder, you can also open the Spotlight window directly, without using the Spotlight menu as a trigger. Actually, there are three ways to get there (Figure 3-2):

If all you want to do is search your entire computer for files containing certain text, you might as well use the Spotlight menu described at the beginning of this chapter.

The power of the Spotlight window, though, is that it lets you design much more specific searches, using over 125 different search criteria: date modified, file size, the “last opened” date, color label, copyright holder’s name, shutter speed (of a digital photo), tempo (of a music file), and so on. Figure 3-3 illustrates how detailed this kind of search can be.

To set up a complex search like this, use the second row of controls at the top of the window.

And third, and fourth, and fifth. Each time you click one of the buttons at the right end of the window, a new criterion row appears; use its pop-up menus to specify what date, what file size, and so on. Figure 3-3 shows how you might build, for example, a search for all photo files that you’ve opened within the last week that contain a Photoshop layer named Freckle Removal.

To delete a row, click the button at its right end.

Here’s a rundown of the ways you can restrict your search, according to the options in the first pop-up menu of a row. Note that after you choose from that first pop-up menu (Last Opened, for example), you’re supposed to use the additional pop-up menus to narrow the choice (“within last,” “2,” and “weeks,” for example), as you’ll read below.

When you choose one of these options from the first pop-up menu, the second popup menu lets you isolate files, programs, and folders according to the last time you opened them, the last time you changed them, or when they were created.

Spotlight likes to find text anywhere in your files, no matter what their names are. But when you want to search for an icon by the text that’s in only its name, this is your ticket. (Capitalization doesn’t matter.)

Wouldn’t it be faster just to click the File Name button at the top of the window? Yes—but using the Search window offers you far more control, thanks to the second pop-up menu that offers you these options:

If this were a math equation, it might look like this: options x options = overwhelming.

Choosing Other from the first pop-up menu opens a special dialog box containing at least 125 other criteria. Not just the big kahunas like Name, Size, and Kind, but far more targeted (and obscure) criteria like “Bits per sample” (so you can round up MP3 music files of a certain quality), “Device make” (so you can round up all digital photos taken with, say, a Canon Rebel camera), “Key signature” (so you can find all the GarageBand songs you wrote in the key of F sharp), “Pages” (so you can find all Word documents that are really long), and so on. As you can see in Figure 3-4, each one comes with a short description.

You may think Spotlight is offering you a staggering array of file-type criteria. In fact, though, big bunches of information categories (technically called metadata) are all hooks for a relatively small number of document types. For example:

This massive list also harbors a few criteria you may use more often, like Size, Label, and Visibility (which lets you see all the invisible files on your hard drive). See the box on Feeding the Barren Pop-up Menus.

Now, you could argue that in the time it takes you to set up a search for such a specific kind of data, you could have just rooted through your files and found what you wanted manually. But hey—you never know. Someday, you may remember nothing about a photo you’re looking for except that you used the flash and an f-stop of 1.8.

In Snow Leopard, more than ever, the results window is a regular old Finder window, with all the familiar views and controls (Figure 3-5).

You can work with anything in the results window exactly as though it’s a regular Finder window: Drag something to the Trash, rename something, drag something to the desktop to move it there, drag something onto a Dock icon to open it with a certain program, Option-⌘-drag it to the desktop to create an alias, and so on.

You can move up or down the list by pressing the arrow keys, scroll a “page” at a time with the Page Up and Page Down keys, and so on. You can also highlight multiple icons simultaneously, the same way you would in a Finder list view: Highlight all of them by choosing Edit→Select All; highlight individual items by ⌘-clicking them; drag diagonally to enclose a cluster of found items; and so on.

Or you can proceed in any of these ways:

You’ve just read about how Spotlight works fresh out of the box. But you can tailor its behavior, both for security reasons and to fit it to the kinds of work you do.

Here are three ways to open the Spotlight preferences center:

In any case, you wind up face to face with the dialog box shown in Figure 3-6.

You can tweak Spotlight in three ways here, all very useful:

Ordinarily, Spotlight looks for matches wherever it can, except in other people’s Home folders. (That is, you can’t search through other people’s stuff).

But even within your own Mac world, you can hide certain folders from Spotlight searches. Maybe you have privacy concerns—for example, you don’t want your spouse Spotlighting your stuff while you’re away from your desk. Maybe you just want to create more focused Spotlight searches, removing a lot of old, extraneous junk from its database.

Either way, the steps are simple. Open the Spotlight panel of System Preferences, as described previously. Click the Privacy tab. Figure 3-7 explains the remaining steps.

Once you’ve built up the list of private disks and folders, close System Preferences. Spotlight now pretends the private items don’t even exist.

You may remember from Chapter 1 (or from staring at your own computer) that the Sidebar at the left side of every desktop window contains a set of little folders under the Searches heading. Each is actually a smart folder—a self-updating folder that, in essence, performs a continual, 24/7 search for the criteria you specify. (Smart folders are a lot like smart albums in iPhoto and iTunes, smart mailboxes in Mail, and so on.)

The ones installed there by Apple are meant as inspiration for you to create your own smart folders. The key, as it turns out, is the little Save button in the upper-right corner of the Spotlight window.

Here’s a common example—one that you can’t replicate in any other operating system. You choose File→Find. You set up the pop-up menus to say “last opened date” and “this week.” You click Save. You name the smart folder something like Current Crises, and you turn on “Add to Sidebar” (Figure 3-8).

From now on, whenever you click that smart folder, it reveals all the files you’ve worked on in the past week or so. The great part is that these items’ real locations may be all over the map, scattered in folders all over your Mac and your network. But through the magic of the smart folder, they appear as though they’re all in one neat folder.