Making Content Searchable

Describe and index your app content so it is searchable.


The Core Spotlight APIs help you provide a comprehensive description of an item and to add it to the on-device index. They support indexing items at any time, such as when your app loads.

To start indexing app content, perform these steps:

  1. Create a CSSearchableItemAttributeSet object and specify properties that describe the item you want to index.

  2. Create a CSSearchableItem object to represent the item. A CSSearchableItem object has a unique identifier that lets you refer to it later.

  3. If needed, specify a domain identifier so that you can gather multiple items together and manage them as a group.

  4. Associate the attribute set with the searchable item.

  5. Add the searchable item to the index.

As you use Core Spotlight to make your app content searchable, you can also use NSUserActivity to make app states and navigation points searchable and to help users return to an activity or app location when they tap on a search result.

Both Core Spotlight and NSUserActivity use a CSSearchableItemAttributeSet object to describe a searchable item, provide rich metadata that is displayed in search results, and prevent duplication of items in search results. Unlike the NSUserActivity API, however, Core Spotlight APIs don’t require users to visit the content before it gets indexed.

When you use both APIs, you can improve the ranking of your items in search results and prevent item duplication by specifying the same value in relatedUniqueIdentifier (NSUserActivity) and uniqueIdentifier (CSSearchableItem).

If your app has related content on a website, you should also mark up your website and support universal links to ensure that users can open your native app when they tap a search result supplied by your website (if your app isn’t installed, tapping the result opens Safari).

See Also

First Steps


An item that can be indexed and made available to users when they search on their devices.