While Apple's spotlight search is a great way to find files and folders on your Mac, there are some limitations to its default behavior that can sometimes prevent an item from being easily found. In addition, sometimes Spotlight will just not work altogether. Nevertheless there are many hidden features in Spotlight that can help overcome its limitations.
MacFixIt reader "Chuck" recently wrote in asking us about some problems in Spotlight:
"Apple's Search feature in Spotlight as well as other apps that use the Apple search code appear to be inadequate and sometimes just broken. For example, try searching for ")SEL" no hits. But a search for "SEL" will find many hits, including the ")SEL" that you were looking for, but there are so many hits, it is like looking for a needle in a haystack. I have also seen cases where I searched for 'ABCD', but it found things like 'AB CD'! Why would it think that the space was unimportant?"
Spotlight does have a few bugs, and it appears one of these is the inability to search for terms that begin with parentheses which do not have any text in the parentheses.
Looking beyond any bugs, however, there may be ways to refine searches using Spotlight's many hidden options. Apple's help documentation on Spotlight only shows the basics of how to use it, but there are numerous ways to refine searches and find items you are looking for.
A while ago we posted an article on some ways to customize spotlight searches so the search can be narrowed a bit; however, even this is only the tip of the iceberg of possibilities in Spotlight.
The first thing you can do to change Spotlight's behavior is to limit the search scope. In the Spotlight System Preferences you can check and uncheck items in the list to prevent them from being included in spotlight search results. Additionally, you can add specific folders to the Privacy list to prevent them from being included. By default Time Machine and System folders are not included in searches; however, they can be searched if desired.
Limit by kind
While you can use Spotlight's preferences to select the types of files to include in searches, you can also do this directly in the spotlight search bar with the "kind:" tag. After entering your search phrase, follow it with "kind:" and a keyword to designate the type of file. These can be any in the following list:
You can also be more specific, so instead of including just "document" as a file type, you can be more specific with "text" or "word." These are ones I have found so far; however, there may be others. Keep in mind that not all apparent document types are supported, so for instance you cannot isolate all Pages documents by using "pages" as a document type even though "text" works. Here are some specific document types you can use:
This is only a small set of the document types that are available on my system. The ones one one system may also be different than those on another system, since what spotlight will search by depends on what is in the spotlight index. While individual words will work, many document "type" strings are multiple words (such as "internet location") which will require you to put quotes around them (ie, kind:"internet location"), otherwise only the first term in the document type will be included in specifying the document type.
Open in Finder
Once you have found the item you are looking for in Spotlight, pressing enter will open the file; however, you can also open the file's enclosing folder in the Finder by holding the Command key down when you press enter.
Another hidden aspect of Spotlight is its support of logic operators, which allow it to include and exclude specific phrases in the search. These are words like "AND," "OR," and "NOT," which can be used with multiple search strings to narrow down the search. For instance, you can use "AND" to to search for items that contain two search strings, or you can use "OR" to search for items that contain either of the search strings. If you have a search string you would like to exclude, you can use "NOT." For instance, you can find all documents in your system that are about Microsoft and Apple but not about Yahoo by entering the following search:
Microsoft AND Apple NOT Yahoo
You can also set an order-of-operations precedence in the search by encompassing some of the phrases and logical operators in parentheses, such as the following example that will search for all items with Apple in the name, but not the others:
Apple NOT (Google OR Yahoo OR Microsoft)
In addition to logic operators, you can also include specific phrases in the search by surrounding them with double quotation marks. If you search using a phrase and do not use quotes, each word will be searched for independently, and while Spotlight will rank findings based on word prevalence, it will still return a number of results. Enclosing the phrase in quotes will narrow the search to items that only include the phrase.
Combining operators, phrases, and file type searches can further narrow results, such as the following example, which will include all PDFs and Text files containing the phrase "Apple Computer" that do not have the words Google, Yahoo, or "Microsoft Corporation" in them:
"Apple Computer" kind:pdf OR "Apple Computer" kind:text NOT (Google OR Yahoo OR "Microsoft Corporation")
Alternate uses and limitations
In Leopard, Apple updated Spotlight to include a calculator feature, which can be useful for quick calculations. If you press enter with a calculation result highlighted the Calculator application will open, though it will display a "0" and not the results of the calculation done by spotlight. This does limit the usefulness of this feature, but it nevertheless allows for you to quickly launch the calculator by entering a quick calculation like "1-1" and pressing enter.
Unfortunately one search option that is missing in Spotlight is the capability to search the Web. It would be great to be able to enter URLs or specify a Google search that would launch the default browser and present you with search results; however, for now Spotlight is limited to searching previously visited sites that are still cached on the system.