In WWDC 2013 Session 211 Core Data Performance Optimization and Debuggingpages 128-131 discuss using a canonicalized search in Core Data. So I am attempting to configure my Core Data model to support this method of searching. I've created a Tokens object with a token attribute of type String (?? Considering whether changing this to type transformable to support saving a string as an Array would be better ??). I also create a relationship between the Tokens object and the base entity on my data model. From the talk, it's not precisely clear how one would use this setup. So for example, I know that I probably want to use an inexpensive query against the Tokens entity with an operator like BEGINSWITH but would ANY and other operators be too costly to use?
Also I can't find any sample projects showing how to implement the search-token algorithm. So, it's a bit unclear if I should have one word in each token or if I have a string in each token attribute then it's not entirely clear how to parse that efficiently (e.g. assuming I parsed the string into the attribute of type Transformable, so that I could use CONTAINS on the array - is that recommended??). The talk did infer that one could use components from string to derive an array and somehow work with that (mentioned only in passing).
Since performance is such a problematic and widespread topic, I'd appreciate any insights (snippets or instructions) on how I should complete the implementation and make use of the search-tokens within an app.
Finally I note that new fields now support Spotlight. Should I enable this? Would this be an alternative to the search-token approach? I am trying to remain within the confines of Apple APIs (no third party dependencies). Ultimately I want to use a search controller / tableview to quickly provide full-text search capability using the search-token paradigm.