With the release of Lion, Apple has added a new feature to the already useful and powerful Spotlight search called Search Tokens. Spotlight is already a major part of my day to day work flow and if you haven’t already found yourself using Spotlight I highly recommend taking a day and challenging yourself to type Command + Spacebar and searching for your documents to retrieve them as opposed to sifting through the Finder the old-fashioned way. I think you’ll find fairly quickly that the Finder nearly becomes irrelevant with the exception of necessary tasks such as creating folders, managing your data, or accessing network shares.
What is a Search Token?
Lets start with the concept of a token. Every file on your Mac, when saved, stores additional information about itself called metadata. Metadata in its simplest form is stored information about your data. Information such as date created, file size, document kind, the application that created it, and so on. To get a visual representation of metadata, all you have to do is open the Get Info pane of any file on your Mac and observe the information in the pane. This is all the metadata associated with files that you selected. A token is derived from these pieces of information.
Spotlight already uses metadata when you do a basic search so you might be asking yourself, why do I need tokens if I can search using metadata? Tokens allow for much more fine-grained control over your search while you are searching.
Searching with Tokens
Search Tokens can be used from within the Finder and with Apple Mail, which is especially handy. Let’s say you have a document on your Mac that you need to hunt down. Typically you could search using Spotlight from the menu bar or finder and type the name of the document or maybe some information located within the document as you best remember it. With Search Tokens you can instead use elements such as file type, date, and names that describe your document and then string them together to narrow down your search.
Here’s an example:
Here we are searching for an image that I downloaded from my iPhone. I started by typing in PNG because I knew the file type that the phone creates when doing a screen capture and immediately the search field provides me the option of selecting the kind token.
Next, I type in Wil and again we are presented with some options. Since I had sent this file via email, I chose Sent By.
Finally, I further modified my search using the search criteria bar located under the search field when searching by adding the date that I had received it.
Search Tokens are a very powerful way to search quickly and sort through the noise that you might come across when trying to find specific files on your Mac and, as you might expect, it works exactly as demonstrated here within the Mail app.
If you have any further questions regarding Search Tokens or something to add, please feel free to post your thoughts in the comments.