How to add logic to search results in OS X
You can greatly narrow search results in the Finder by adding logical operators to include and exclude specific files.
When searching for items in OS X, you can use the Spotlight menu or perform a Finder search routine. Finder, unlike the Spotlight menu, offers a number of filtering options you can add to your search to narrow down results, and you can even save them as canned searches that Apple calls Smart Folders.
To create a filtered search, simply press Command-F in the Finder, and the foremost window will convert to a search window, or you can start entering a search term in the Finder search bar at the top right of each window.
With the search window active, you can choose to search the computer ("This Mac"), the current folder, or mounted shares for specific files. Below this search scope, you can add a number of metadata filters to narrow your search results. The search may have Kind set to "Any," though you can designate audio files, PDFs, folders, and images, and you can click the plus button to add more filters.
By default when you add more filters they are all included, so filter 1 and filter 2 would both be applied to the search results. However, you can apply different logic operators such as "or" and "not" to the search results.
To do this, hold the Option key when clicking the plus button, and filters added will be placed under an operator selector, where you can have the results include "any" of the following filters (logical "or"), have it exclude the items found in the filters (logical "not"), or go with the default "all" inclusive (logical "and").
In this way, you can for example build a search result that will include all PDF documents that were opened within the last week, but not located within a specific folder, and then nest a couple of filters to exclude files with one or more key words in their names.
The possibilities for customizing searches in this manner are almost endless. And as with any other custom search, you can save these searches so you can quickly access them, if needed.
In addition to smart searches, you can apply logic to searches in the Spotlight menu. Simply include capital AND and OR. For example, to locate a file with a name or contents containing either "MacBook" or "Apple," you would search for "MacBook OR Apple" in Spotlight.