title: NSPredicate case-insensitive matching on to-many relationship
body: <p>I am implementing a search field where the user can type in a string to filter the items displayed in a view.  Each object being displayed has a <code>keywords</code> to-many relationship, and I would like to be able to filter the objects based on their keywords.  Each keyword object has a <code>name</code> property, so I've set up an NSPredicate to do the filtering that looks like this:</p>
  
  <pre><code>NSPredicate* predicate = [NSPredicate predicateWithFormat:@"keywords.name CONTAINS %@", self.searchString];
  </code></pre>
  
  <p>This works, but the problem is that the search is case-sensitive, so if the keyword has a capital letter but the user types in all lowercase, no matches are found.  I've tried the following modification:</p>
  
  <pre><code>NSPredicate* predicate = [NSPredicate predicateWithFormat:@"keywords.name CONTAINS[c] %@", self.searchString];
  </code></pre>
  
  <p>But that doesn't make any difference in the case sensitivity of the matching.  Is there a way to do this case-insensitive matching using just a plain predicate? Or will I need to implement some sort of custom accessor on the keyword class, e.g. write a <code>lowercaseName</code> method and match against a lowercased version of the search string instead?</p>
  
  <p>Addendum:
  After further exploration, the workaround of adding a custom accessor works OK for manual use of NSPredicate, but does not work at all when using NSFetchRequest with Core Data, which only works when querying attributes defined in the Core Data model.</p>