Impossible to inspect the contents of the Core Spotlight index

Originator:bogo.giertler
Number:rdar://22096010 Date Originated:07/31/2015
Status:Open Resolved:
Product:iOS SDK Product Version:iOS 9.0 (13A4305g)
Classification:Enhancement Reproducible:Always
 
Summary:
Core Spotlight indices behave as a write-only variable. For example, it is impossible to inspect their contents to find out what CSSearchableItems are currently indexed in the searchable index.

In case the application works with data that may be changed outside of it (e.g. account state is being synced across devices via a third party service) this may be necessary to find out whether the index contains stale data.

Lack of this API forces developers to reimplement (possibly imperfectly) the index as a local database and make sure the Core Spotlight and their own index remain in sync.

Steps to Reproduce:
Investigate the headers of CSSearchableIndex.

Expected Results:
CSSearchableIndex instance should have a public method such as:

- (void)enumerateSearchableItemsUsingBlock:(void (^ nonnull)(NSArray<CSSearchableItem *> nonnull *searchableItems))block;

Such method would call the block with an array containing the CSSearchableItems currently present in the searchable index.

Actual Results:
No such method exists.

Version:
iOS 9 beta 4

Configuration:
iPhone 6 and iOS Simulator

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!