---
title: CSSearchableIndex
framework: corespotlight
role: symbol
role_heading: Class
path: corespotlight/cssearchableindex
---

# CSSearchableIndex

An on-device index for your app’s searchable content.

## Declaration

```swift
class CSSearchableIndex
```

## Mentioned in

Adding your app’s content to Spotlight indexes Generating summary and priority data for indexed items

## Overview

Overview A CSSearchableIndex object manages an on-device index for your app’s searchable content. To make your app’s content searchable, package it in one or more CSSearchableItem objects and add them to the index. You can create as many searchable indexes as you need to manage your content, and you can apply different levels of encryption to protect the content in each index. When you execute a query, Core Spotlight searches your app’s indexes for the requested information and returns the results to your code. note: If your app creates NSUserActivity objects, set the isEligibleForSearch property of those objects to true to ensure they appear in search results. Put your content into a custom CSSearchableIndex that you create. Custom indexes support batch operations and additional levels of data protection. Place sensitive personal information in protected indexes to encrypt that content, and prevent its disclosure without proper authorization from the owner of the device. Although you can put content into the default index, you can’t encrypt the content in that index or perform batch operations to add content to it. When adding large amounts of data to the index, consider adding it in batches to minimize risk. Batch-based updates make it easier to handle errors that might occur during the indexing process. For each batch, you provide client-state information to identify the current batch. If your app or extension crashes while a batch operation is in progress, you can use that state information to determine where to start indexing again later. Modify custom CSSearchableIndex objects only on one thread or task at a time. It’s a programming error to access a custom index from multiple threads simultaneously. When performing batch updates on an index, start each new batch operation only after calling the endBatch(withClientState:completionHandler:) or endIndexBatch(expectedClientState:newClientState:completionHandler:) method of the previous batch operation.

## Topics

### Creating an index

- [default()](corespotlight/cssearchableindex/default().md)
- [init(name:)](corespotlight/cssearchableindex/init(name:).md)
- [init(name:protectionClass:)](corespotlight/cssearchableindex/init(name:protectionclass:).md)

### Determining if indexing is available

- [isIndexingAvailable()](corespotlight/cssearchableindex/isindexingavailable().md)

### Responding to index-related changes

- [CSSearchableIndexDelegate](corespotlight/cssearchableindexdelegate.md)
- [indexDelegate](corespotlight/cssearchableindex/indexdelegate.md)

### Managing items in an index

- [indexSearchableItems(_:completionHandler:)](corespotlight/cssearchableindex/indexsearchableitems(_:completionhandler:).md)
- [deleteAllSearchableItems(completionHandler:)](corespotlight/cssearchableindex/deleteallsearchableitems(completionhandler:).md)
- [deleteSearchableItems(withDomainIdentifiers:completionHandler:)](corespotlight/cssearchableindex/deletesearchableitems(withdomainidentifiers:completionhandler:).md)
- [deleteSearchableItems(withIdentifiers:completionHandler:)](corespotlight/cssearchableindex/deletesearchableitems(withidentifiers:completionhandler:).md)

### Indexing app entities

- [indexAppEntities(_:priority:)](corespotlight/cssearchableindex/indexappentities(_:priority:).md)
- [deleteAppEntities(ofType:)](corespotlight/cssearchableindex/deleteappentities(oftype:).md)
- [deleteAppEntities(identifiedBy:ofType:)](corespotlight/cssearchableindex/deleteappentities(identifiedby:oftype:).md)

### Batching index updates

- [beginBatch()](corespotlight/cssearchableindex/beginbatch().md)
- [endBatch(withClientState:completionHandler:)](corespotlight/cssearchableindex/endbatch(withclientstate:completionhandler:).md)
- [endIndexBatch(expectedClientState:newClientState:completionHandler:)](corespotlight/cssearchableindex/endindexbatch(expectedclientstate:newclientstate:completionhandler:).md)
- [fetchLastClientState(completionHandler:)](corespotlight/cssearchableindex/fetchlastclientstate(completionhandler:).md)

### Handling drag and drop content

- [fetchData(forBundleIdentifier:itemIdentifier:contentType:completionHandler:)](corespotlight/cssearchableindex/fetchdata(forbundleidentifier:itemidentifier:contenttype:completionhandler:).md)

### Getting the protection class

- [protectionClass](corespotlight/cssearchableindex/protectionclass.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Indexes

- [Generating summary and priority data for indexed items](corespotlight/generating-summary-and-priority-data-for-indexed-items.md)
- [CSSearchableIndexDelegate](corespotlight/cssearchableindexdelegate.md)
- [CSSearchableIndexDescription](corespotlight/cssearchableindexdescription.md)
