---
title: "deleteSearchableItems(withDomainIdentifiers:completionHandler:)"
framework: corespotlight
role: symbol
role_heading: Instance Method
path: "corespotlight/cssearchableindex/deletesearchableitems(withdomainidentifiers:completionhandler:)"
---

# deleteSearchableItems(withDomainIdentifiers:completionHandler:)

Removes from the index all searchable items associated with the specified domain.

## Declaration

```swift
func deleteSearchableItems(withDomainIdentifiers domainIdentifiers: [String], completionHandler: (@Sendable ((any Error)?) -> Void)? = nil)
```

```swift
func deleteSearchableItems(withDomainIdentifiers domainIdentifiers: [String]) async throws
```

## Parameters

- `domainIdentifiers`: The domain identifier that describes the group of items to delete. To learn more about domain identifiers, see doc://com.apple.corespotlight/documentation/CoreSpotlight/CSSearchableItem/domainIdentifier.
- `completionHandler`: The block that’s called when the request has been journaled by the index (“journaled” means that the index makes a note that it has to perform this operation). Note that the request may not have completed. The block receives the following parameter:

## Discussion

Discussion important: You can call this method from synchronous code using a completion handler, as shown on this page, or you can call it as an asynchronous method that has the following declaration: func deleteSearchableItems(withDomainIdentifiers domainIdentifiers: [String]) async throws For information about concurrency and asynchronous code in Swift, see Calling Objective-C APIs Asynchronously. Use this method to delete groups of items. Note that the delete operation is recursive. For example, if domain identifiers are of the form <account-id>.<mailbox-id>, calling this method and specifying <account-id> deletes items with the specified account and any mailbox.

## See Also

### Managing items in an index

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