Phuah Yee Keat
Phuah Yee Keat

Reputation: 1630

NSCoreDataCoreSpotlightDelegate indexing existing data

I am implementing CoreDataCoreSpotlight integration as per the WWDC 2017 video https://developer.apple.com/videos/play/wwdc2017/210/

Its a simple code like:

container.persistentStoreDescriptions.forEach {
    $0.setOption(MyCoreDataCoreSpotlightDelegate(forStoreWith:$0, 
        model: container.managedObjectModel), 
        forKey:NSCoreDataCoreSpotlightExporter)
}

This lets me search for newly added items, and delete items works too, it is automatically removed from spotlight (despite after a few seconds).

I can't get it to index my existing data, is it supposed to do so? I was under the assumption that it should, since it uses persistent history tracking.

Upvotes: 2

Views: 368

Answers (1)

Phuah Yee Keat
Phuah Yee Keat

Reputation: 1630

Found the issue, the code is supposed to index existing data. I just need to set one of the field in my core data model object to be indexed. This is such a hidden requirement.

Upvotes: 2

Related Questions