re: Core Data & Spotlight: Record-Level Indexing : Issues?
re: Core Data & Spotlight: Record-Level Indexing : Issues?
- Subject: re: Core Data & Spotlight: Record-Level Indexing : Issues?
- From: Ben Trumbull <email@hidden>
- Date: Fri, 12 Mar 2010 15:57:59 -0800
> "On Mac OS X v10.6 and later, for non-document-based programs, you can create Spotlight indexes where each record is indexed individually." [1] I interpret this to mean that users can get results for my app's records in their Spotlight searches, the way they get Safari bookmarks and Address Book contacts.
>
> Before I get in too deep, I was hoping someone could advise on potential trouble areas:
>
> 1. My app is document-based, although in the use-case for which this feature, the user has only one document. I'd like it to index that one. I presume that by "non-document-based programs", Apple is actually referring to the store -- in other words, if I provide in my document-based app a non-document-based store, Spotlight can index the records in that store. So I'll copy objects from the user's selected document into the new non-document-based store. Should it work? Does anyone have a more elegant suggestion?
I'm not sure what user experience you are trying to effect here. It's sounds like you'd be better off if this part of your app was just not document based at all.
The HI guidelines are such that document based apps should not perform row level Spotlight indexing. You can see that is the case empirically with the Spotlight menu.
>
> 2. "Although you can use your custom managed object classes in the importer, the Core Data External Record daemon ... canâ•˙t use custom managed object classes." All of my managed objects are *subclasses* of NSManagedObject. Is that what they mean by "custom managed object classes"?
It means within the importing code you'll just have NSManagedObjects encapsulating your data. All your persistent properties defined in the model will be accessible, but any custom methods or business logic will not.
> If so, then the Core Data External Record daemon won't be working for me, but it's "optional" and only to "improve performance". On the other hand, my objects have several dozen properties, only a few of which will be indexed. So if I need to implement another non-document store anyhow, maybe I should copy my objects to simple NSManagedObjects, copying only the few properties which I want indexed by Spotlight or are necessary to act upon a hit.
>
> 3. Project currently uses Mac OS 10.5 SDK. If I still want to support 10.5, I need to bite the bullet, read the Cross-Development Programming Guide and configure the project for cross-development, but in the end, Record-Level Indexing should work for my 10.6 users. 10.5 users simply won't get any of my results in their Spotlight searches. Any known gotchas in there?
In theory, but since your app is document based, the preferred approach would be to use the whole document spotlight importer.
> 4. Can't find any sample code. It would be nice to see that Record-Level Indexing has been done?
You can create a new project with the template and it should be a functional sample. Both document based and non-document based Core Data projects have templates with spotlight importers.
- Ben
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden