Instance Method

indexSearchableItems(_:completionHandler:)

Adds or updates items in the index.

Declaration

func indexSearchableItems(_ items: [CSSearchableItem], completionHandler: ((Error?) -> Void)? = nil)

Parameters

items

An array of searchable items to add or update.

completionHandler

The block that’s called when the data has been journaled by the index, which means that the index makes a note that it has to perform this operation. If the completion handler returns an error, it means that the data wasn’t journaled correctly and the client should retry the request.

The block receives the following parameter:

error

If an error occurred, this parameter holds an error object that explains the error. Otherwise, the value of this parameter is nil.

Discussion

The searchableIndex(_:reindexSearchableItemsWithIdentifiers:acknowledgementHandler:) protocol method is called in the case that the journaling completed successfully but the data was not able to be indexed for some reason.

See Also

Managing Items in an Index

func deleteSearchableItems(withDomainIdentifiers: [String], completionHandler: ((Error?) -> Void)?)

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

func deleteSearchableItems(withIdentifiers: [String], completionHandler: ((Error?) -> Void)?)

Removes from the index all items with the specified identifiers.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software