Search and Spotlight
Quick access to content is key to an efficient workflow, and there are several ways you can make it easy for people to locate your app's content.
Spotlight is a powerful search technology that makes it easy to locate files and content across the system. Using Spotlight, people can search for things using meaningful attributes like the intended audience for a document or the orientation of an image.
Make your app’s content searchable. You can share content with Spotlight by making it indexable and specifying descriptive attributes—known as metadata. Spotlight extracts, stores, and organizes this information to allow for fast, comprehensive searches. For developer guidance, see Core Spotlight.
Define metadata for your custom file types. Supply a Spotlight Importer plug-in that describes the types of metadata your file format contains. For developer guidance, see Spotlight Importer Programming Guide.
Use Spotlight to offer advanced file-search capabilities within the context of your app. For example, you might include a button that instantly initiates a Spotlight search based on the user’s selection. You might then display a custom window that presents the search results or a filtered subset of them.
Use the standard Open and Save dialogs. When opening or saving a document, people often need to locate a file or folder in an atypical location. The standard dialogs include a built-in search field that can be used to search and filter the entire system. For related guidance, see File Handling.
Implement a Quick Look generator if your app produces custom file types. A Quick Look generator enables other apps, including Spotlight, to show previews of your documents. These previews can be tremendously helpful when trying to locate a specific document. See Quick Look.
Consider using Spotlight behind the scenes. For example, an app could let people choose a broad file category, like images, to sync with a remote server, and then use Spotlight to find those files.
In-App Content Search
While Spotlight is tuned to locate files quickly, it’s not intended for performing extensive content searching within an app. An app that stores data in database records, for example, shouldn’t base its database search on Spotlight because the data aren’t stored in separate files.
Use system APIs to enable fine-grained textual searching. The system-provided APIs support phrase-based searching, prefix/suffix/substring searching, Boolean searching, summarization, relevance ranking, and more. For developer guidance, see Search Kit.
Let people save searches whenever possible. Users appreciate being able to perform specific searches again, especially if they spent time defining (and refining) useful criteria.
A Find window is a nonmodal dialog used to search for content within a document. A Find window lets the user specify search criteria, including an item to search for and options for narrowing the scope of the search. Options when performing a text-based search, for example, might include whole word and case matching. The Find window is typically displayed by choosing a Find menu item in the Edit menu (or pressing its equivalent keyboard shortcut). See Edit Menu.
If your app is document-based, consider implementing a Find window. Most document-based apps include Find windows, and users are accustomed to looking for and using them.
Offer find and replace functionality. While searching is great for locating content, it’s not ideal when a user has to manually change each found result. If a search feature is accompanied by a replace feature, the user can automatically change all found results in a single step.
If appropriate, let people perform multi-document find operations. In an app that lets people edit multiple documents at once, the ability to perform a global search—and replace too, if applicable—across all open documents can be a valuable time-saving feature.
Document searching is important, but not all apps are document-based. For example, some apps present content-rich views—like tables—that can be overwhelming when they're extensive. Users may appreciate the ability to filter these types of views in order to narrow in on specific items.
Use a search field and scope bar to enable content filtering in a view. A search field lets people initiate text-based searches in a large collection of values and a scope bar helps them refine or filter results. For guidance, see Search Fields, Scope Bars, and Scope Buttons.