One of the features I like the most about OS X 10.5 is Spotlight —yes, coming from me, that might seem strange, but Apple has addressed nearly every issue I had with Spotlight in Tiger. In particular, I’m thrilled that you can search for phrases within documents, and use boolean operators (such as AND, OR, and NOT) to further restrict your search results.
You can use booleans by typing them in, of course, but if you’re more visual by nature, you can also use the Finder’s search window to do boolean searches without ever typing AND or OR. The secret? A hidden feature in the Finder’s search window. By way of example, consider this hypothetical search: I’d like to find anything in my Macworld weblogs folder that contained the word Terminal , and the word Safari or the phrase defaults write . If I wanted to type it out, that query would look like this in Spotlight-speak:
Terminal AND (Safari OR "defaults write")
If I type that into the Spotlight search box with my Macworld weblogs folder selected, Spotlight will find 41 matches. Now here’s the secret to building that same query without having to type it all out. Start a search as usual in the Finder; in this case, I’d do that by typing Terminal in the search field, and then choosing my Macworld weblogs folder as the search location. After the initial results appear, click the plus sign to add another criterion…and then it’s time for the magic.
The first added criterion will be Kind is Any, and I’ll just leave that as is. But instead of just clicking the plus sign to add another criterion, the secret to more powerful Finder searches is to hold the Option key down. After you have one criterion in place (Kind is Any, in this example), the Option key will change the plus sign into an ellipsis (…). Click that while holding the Option key, and you’ll get a new conditional section. You can set the conditional for Any (OR), All (AND), or None (NOT). Just enter the terms you’d like to search on in the conditional section, and you’ll see the results in real time.
Since this is harder to explain than it is to do, here’s a movie showing the building of the above query:
As you can see, I just had to insert Contents searches for both Safari and “defaults write” to find the same 41 matches that I found with the search text above. But using the visual template has advantages, as you can see in the video—by just changing Any to All in the pop-up menu, I can also see how many files I have that contain Terminal and both Safari and “defaults write” (four documents). If I switch it to None, I find that there are 86 documents that contain Terminal but don’t contain either Safari or “defaults write” .
This Option-click trick adds a lot of power to your Finder searches; just remember you can only Option-click after you have at least one criterion already created for your search.