Improving File Searches With Search Tokens

Thanks to powerful search features that have been developed in recent years, you no longer need to manually browse your computer’s hard drive if you’re looking for a file. Instead, you let the machine’s search technology find the file for you.

As another advancement in this field, Apple introduced a novel UI element in OS X 10.7 Lion: The so called “search token” aims to simplify compound searches.

Entering compound file searches

A compound search combines searches across several metadata fields to fine-tune the list of resulting matches.

For example, to find all presentations about Mac topics from this year1, you might look for files whose …

  • kind is (Keynote) presentation,
  • date is this year, and
  • contents include “Mac”.

Previous versions of Mac OS X offered two methods for entering this kind of search. The more efficient one uses Spotlight with search operators like “kind:” or “date:”.

To run the example search, you would enter “kind:pdf date:2011 mac”2 into Spotlight’s search field.

Apple has published a complete list of Spotlight operators as well as further information on how to use Spotlight operators on their support website.

FinderSearchSpotlight

Besides having to remember which operators are available, and what their correct spelling is, you must know about this Spotlight feature in the first place. The chance of accidentally discovering it is very slim.

The second method for entering a compound search is by using the metadata fields in the Finder’s search window.

FinderSearchWindow

While entering a search this way is not as efficient as using Spotlight operators, it is much easier to discover, and the menus provide a built-in reference for the searchable file attributes.

The best of both of these methods has been combined into the new “search tokens”: Pure text entry and a menu of search suggestions.

Entering compound file searches with tokens

As soon as you start typing something into a Finder window’s search field, a menu pops up. Its contents are grouped by the metadata fields in which your search string was found.

FinderSearchSuggestions

When you see what you’re looking for, you select its menu item with a mouse click or via the cursor keys on your keyboard. There is no need to switch between keyboard and mouse while you refine your search.

When you make a selection from the menu, the search is encapsulated in a lozenge-shaped token, which combines your search term with the metadata field within which the search is performed.

FinderSearchToken

After adding a new token, you can continue typing to further refine your search.

FinderSearchTokenCompound

Unfortunately, the search field has a maximum width of about 35 characters, regardless of how you configure the toolbar in the Finder windows.

On average, this should be sufficient room for two or three search tokens. If you enter a more complex search, however, you cannot see the entire set of criteria at a single glance anymore.3

Combining the best of both worlds — and adding a caveat

Entering compound searches with the new search tokens merges the efficiency of typing into a text field with the discoverability of a menu.

Thanks to the tokens, you need to type even less than if you used Spotlight operators. That’s because you only need to enter the search terms, but not the operators themselves, as you pick these from the menu.

Besides the limited space in the search field, the current implementation of search tokens has one caveat: They only support a small subset of all available file metadata fields. Many more are available in the search section underneath the Finder windows’ toolbar.

Despite these shortcomings, the search tokens make performing compound searches of medium complexity more convenient and more efficient than either of the older methods.


  1. This article was written in 2011. Therefore, even though it was published in early 2012, it refers to “this year” as being 2011. 

  2. According to Apple’s documentation, “date:this year” is supported as well, but I couldn’t get it to work on my machine. Hence the hard-coded “2011”. 

  3. There is a workaround, but it’s rather tedious: If you save a search and then select Show Search Criteria from the resulting Smart Folder’s context menu, the search criteria will not be shown as tokens anymore, but appear in the search fields underneath the toolbar. 

OS X’s Most Un-Mac-like Feature

It’s surprising how often my Macs fail to recognize a CD or DVD when I insert it into the optical drive. The disk is properly pulled into the drive slot and spins up, but its icon does not appear in the Finder.

In order to force-eject such a rogue disk, you have to restart the Mac and hold down the mouse button during the boot process. Before the log in screen appears, the disk will pop out of the drive.

OS X Help page, explaining how to eject disks that refuse to be ejected via the regular command

This brute-force method has worked for me every time I used it, but it is massively disruptive.

Imagine doing creative work on your computer. You have meticulously arranged numerous windows from multiple applications into a super-efficient workspace.

And now you have to close all apps and shut down the entire machine, just because the OS does not properly recognize a CD.

Insane!

You can’t select what isn’t there, …

Why won’t the OS let me select some icon in the Finder and then execute the Eject command? Well, if there is no icon that represents the disk in the drive, how would you select it?

Part of the problem is that the Mac’s Finder differentiates between a (physical) drive and the (logical) volumes stored on that drive. This differentiation also applies to drives with removable media.

In the Finder you will only see icons representing volumes, but none for the physical devices. This is different on Windows.

On Microsoft’s OS, icons for drives with removable media like CD/DVD drives, etc. always appear, regardless of whether there is a medium inside that drive, or not.

In everyday use, there is a drawback to Microsoft’s design, because if you select such a drive while it’s empty, Windows will still try to read from it.

It takes a few seconds until the system recognizes that there is no medium inside the drive, and during that time you cannot continue working inside the specific Windows Explorer window. Which makes inadvertently clicking on an empty drive’s icon rather annoying.

… or can you?!

There is one application on the Mac, however, that does let you access physical drives: Disk Utility.

The Disk Utility application displaying both physical drives and logical volumes, and a Finder window listing only volumes

As you can see in the screenshot, the Finder only displays the volume — “Beyond Tomorrow” — for the computer’s internal hard drive.

In Disk Utility, in contrast, you can also access the physical hard drive as well as the optical drive. The latter is grayed out, since there is no medium inside.

This application would be the logical place for offering an Eject command that operates on the drive, not the medium. Such a function would force-eject whatever is inside the drive, regardless of whether the Finder has properly recognized it, or not.

In fact, this function should probably be deactivated, unless the Finder failed to recognize the disk, so that the user has to properly eject mounted disks to avoid data loss.

Then again, most users will have no need to ever use the Disk Utility application. They may even be scared by it due to its deep-down-inside-the-drives’-guts functionality.

A rare specimen: the non-evil time-out

That’s why I would like to see a different solution to this problem: A time-out!

As much as I loathe user interface time-outs in general, it would make a lot of sense for the computer to automatically eject a removable medium, if it is not recognized within a few seconds after it has been placed inside the drive.

Add in an error message window that informs the user, why the disk has been ejected, and you have a very user-friendly solution to an as-of-yet nasty problem.

Five Ways to Request an Application Restart

Sometimes when you modify a preference setting in a software application, a restart is required for the change to take effect.

Such settings used to be accompanied by a line of text, stating that “Changes to this option won’t take effect until you relaunch the application”.

Nowadays, applications are more helpful in reminding you of a required restart, or even take care of that for you.

To give you a few examples for how developers address this process, here is a look at five Mac OS X applications that require a restart when you show or hide their icon in the Dock or menu bar.

Growl: Do what I say (if you know what that is)!

After changing the icon setting in Growl, a dialog box informs you that the application “must restart for this change to take effect”.

Dialog box displayed in front of Growl's preferences window, and stating that a restart is required for a settings change to take effect

When I saw this dialog box for the first time, I expected the application to restart once I would click the OK button. I found that idea irritating, because I thought, “What if I don’t want to restart the app now? Where’s the Cancel button? Why can’t I back out of this?”

And then I did click OK — and wondered whether the program was buggy, because nothing happened.

It took me a while to understand that this dialog box is purely informational. It does not serve as a warning that the app would actually restart as soon as you click OK.

I would find it helpful if the dialog box expressly prompted you to initiate that restart, e.g., by adding something like “Please quit and restart Growl when you’re done adjusting the settings”.

Better yet, provide a Restart button right inside the dialog box.

Mouseposé: Would you like to restart now, or wait a while?

The “Relaunch required” dialog box in Mouseposé does include a Restart button. A button labeled Later lets you defer the relaunch.

Dialog box displayed in front of Mouseposé's preferences window, and stating that a restart is required for a settings change to take effect

If you do click Later, the change you made to the Show Icon radio buttons is retained, even though the corresponding changes have not been applied to the application’s behavior.

For example, when you change the setting from “Dock and Menu Bar” to “Menu Bar”, and click “Later” in the dialog box, the icon is still shown in both locations.

I see two problems in this behavior.

First, you cannot rely on the preferences displaying the application’s actual settings — i.e., how it behaves right now —, nor can you easily go back to the previous settings.

Second, once you’ve deferred the relaunch and worked with the application for a while, you may forget about having changed any settings. If you then relaunch the application, its changed behavior may come as a surprise and confuse you.

Skitch: Lemme take care of that for you

Skitch‘s icon options are similar to Mouseposé’s. Instead of bringing up a dialog box and allowing the user to defer the relaunch, however, Skitch completely automates the process.

https://uiobservatory.com/media/2011/AutoRelaunchSkitch.png” alt=”Skitch preferences window with a note underneath the “show icon in” option, explaining that the application will automatically restart after a settings change if that is required” border=”0″ width=”400″ height=”302″ />

As it says in the info text underneath the radio buttons, Skitch will simply relaunch if the settings change requires it. The user does not have to do anything, except wait for the application to restart.

Tell me where I can find you

The icon options in Skitch and in Mouseposé have something important in common: You cannot hide both Dock and menu bar icons at the same time. The application will always appear in at least one of these two locations.

Other programs support being turned into background-only applications that are completely hidden from the user’s view. Usually the only means to summon these applications is a keyboard shortcut.

TextExpander: Restart now, or else …

TextExpander is one such application that can hide from the user.

When you select the “Hide TextExpander icon in Dock” option, a warning dialog box will not only inform you that a relaunch is required. It also recommends you define a keyboard shortcut and/or activate the software’s menu bar icon so that you can easily access the application after the relaunch.

Dialog sheet explaining that TextExpander needs to be restarted for a settings change to take effect

Unlike the previously mentioned software programs, TextExpander does not allow deferring the restart. If you choose Cancel, TextExpander clears the option’s checkmark you had just set.

A detail that I found mildly irritating about this dialog box is that its text message always stays the same, regardless of whether a keyboard shortcut has been set or whether the menu bar icon is visible.

I wish the application would provide a bit more guidance to the user by reflecting these settings. E.g., if a keyboard shortcut is set, the dialog box could remind the user accordingly: “To open TextExpander, press Command-Alt-Control-T. You can modify this keyboard shortcut in the Hotkeys preferences panel.”

LaunchBar: Treacherous toggle button at work

In LaunchBar, you can only show/hide the Dock icon, because the application does not have a regular menu bar to begin with. Instead of a checkbox for this option, LaunchBar uses a toggle button.

I’ve written about potential problems with “treacherous” toggle buttons before, and the one in LaunchBar has similar issues.

LaunchBar's Advanced preferences panel featuring a button to 'Hide Dock Icon…'

When you click the button “Hide Dock Icon…”, an elaborate message will point out to you what side effects this setting will have.

Dialog sheet in LaunchBar with a long bulleted list outlining the effects that hiding the application's icon from the dock will have

When the button says “Show Dock Icon…” while you click it, this message does not appear. A relaunch reminder appears after every single click on the button.

LaunchBar's dialog sheet to inform the user that a restart of the application is required

The label on the “Hide/Show Dock Icon…” button will change if you defer the restart, so that it can get out of sync with the actual application’s behavior, just like the settings controls in Mouseposé.

What’s more, when you click Later in the relaunch warning dialog and then repeatedly click the “Hide/Show Dock Icon…” button, the bulleted warning list will show up every time you click “Hide …”.

In contrast, the restart warning never appears again until you actually do quit the and then restart LaunchBar.

A personal opinion

Changing the icon settings in Mouseposé and Skitch is risk-free: You will always be able to “find” either application, because they do not allow you to hide both Dock and menu bar icons at the same time. Consequently, there is no need for a warning beyond requesting the relaunch.

In cases such as these, I like Skitch’s approach of simply restarting itself as necessary, as it does not require any decision making from the user. It just takes care of what needs to be taken care of. “Let the machine do the work for you.”

If there is a risk involved in the settings change — like the application becoming “invisible”, etc. — a confirmation dialog is required.

For these, I prefer TextExpander’s approach of forcing the user to make a decision then and there: Accept the settings change and restart the application, or cancel the restart and discard the settings change.

This is the only way to ensure that what’s displayed in the application’s user interface reflects the actual settings in the application’s guts and, consequently, the software’s behavior.