In my Core Data app, I have an entity Person (which has a fullname attribute). The simplest way of searching for a name is to make the predicate search through the fields:
[predicateArray addObject:[NSPredicate predicateWithFormat:@"fullname CONTAINS[cd] %@", searchString]];
But from what I’ve picked up, this is a regex search that can be expensive, especially if you want to enable live searching (i.e. search while you type) and if the list is very big. Is there some better way of doing this search? Can you transform the fullName somehow to make it quicker to search on?
You’re probably interested in an approach similar to this one:
Core Data search optimization
Basically you create a couple of child search specific entities to optimize for the first few characters.
You’re probably also looking for “begins with” instead of “contains” in your predicate, rarely do people mentally organize their contacts by the middle letters of their name. They usually start by typing “A” for Adam or Andy etc, not “am” or “nd”.