Spotlight support #316

Open
opened 2025-12-29 15:28:46 +01:00 by adam · 1 comment
Owner

Originally created by @seanliu1 on GitHub (Mar 5, 2020).

I recently work on coredata and spotlight integration https://developer.apple.com/videos/play/wwdc2017/210/

Apple introduces a few things NSCoreDataCoreSpotlightDelegate

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

I wonder how to integrate spotlight and coredata using corestore.

I did not find any api exposed by corestore to allow me to do that, the closet thing I can find is storageOption in StorageInterface. However I set it , I will need to have both NSPersistentStoreDescription and NSManagedObjectModel

var storage = SQLiteStore(fileName: "contents.sqlite",
                    localStorageOptions: .allowSynchronousLightweightMigration
        )
        storage.storeOptions = [NSCoreDataCoreSpotlightExporter:MySpotLightDelegate(forStoreWith: <#T##NSPersistentStoreDescription#>, model: <#T##NSManagedObjectModel#>)]
         dataStack.addStorage(
            SQLiteStore(fileName: "contents.sqlite",
                        localStorageOptions: .allowSynchronousLightweightMigration)

not sure what should I put into storeOptions

Originally created by @seanliu1 on GitHub (Mar 5, 2020). I recently work on coredata and spotlight integration https://developer.apple.com/videos/play/wwdc2017/210/ Apple introduces a few things NSCoreDataCoreSpotlightDelegate ``` container.persistentStoreDescriptions.forEach { $0.setOption(MyCoreDataCoreSpotlightDelegate(forStoreWith:$0, model: container.managedObjectModel), forKey:NSCoreDataCoreSpotlightExporter) } ``` I wonder how to integrate spotlight and coredata using corestore. I did not find any api exposed by corestore to allow me to do that, the closet thing I can find is storageOption in StorageInterface. However I set it , I will need to have both NSPersistentStoreDescription and NSManagedObjectModel ``` var storage = SQLiteStore(fileName: "contents.sqlite", localStorageOptions: .allowSynchronousLightweightMigration ) storage.storeOptions = [NSCoreDataCoreSpotlightExporter:MySpotLightDelegate(forStoreWith: <#T##NSPersistentStoreDescription#>, model: <#T##NSManagedObjectModel#>)] dataStack.addStorage( SQLiteStore(fileName: "contents.sqlite", localStorageOptions: .allowSynchronousLightweightMigration) ``` not sure what should I put into storeOptions
Author
Owner

@spacedema commented on GitHub (Sep 29, 2021):

The store must have persistent history tracking enabled to use NSCoreDataCoreSpotlightDelegate, but CoreStore have not.
https://github.com/JohnEstropia/CoreStore/issues/295

@spacedema commented on GitHub (Sep 29, 2021): The store must have persistent history tracking enabled to use NSCoreDataCoreSpotlightDelegate, but CoreStore have not. https://github.com/JohnEstropia/CoreStore/issues/295
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/CoreStore#316