Please help because I think I'm going mad.
I have a core data collection that contains many thousand records. Some of the fields in these records contain terms that have a single quote. When building the database from XML, we created two fields - a NAME field and a SORTFIELD field.
The NAME field contains the full term and is used for display purposes in our application.
The SORTFIELD field contains the same content as the NAME field but is converted to lowercase and has all single quote characters removed using the following.
[NSString stringByReplacingOccurrencesOfString:@"'" withString:@""];
When the user enters the string for which they wish to search, we remove single quotes from the search string entered and convert to lowercase using the same method as when creating the data. However it does not find any results.
If the user enters Michael's, the system fails to find any records
The predicate is "SORTFIELD like 'michaels'"
If the user enters Michael' (single quote no 's' character), the system finds all records starting Michael's
The predicate is "SORTFIELD like 'michael'"
I am sure we are doing something very stupid and appreciate any pointers on how to resolve this issue as we have gone round and round in circles.
We have placed many NSLog entries to track actual content of the search fields and record fields and all display as expected.
Thanks Mike