let predicate = NSCompoundPredicate(orPredicateWithSubpredicates: [
NSCompoundPredicate(andPredicateWithSubpredicates: [
NSPredicate(format: "entity = %@", Note.entity()),
NSPredicate(format: "content CONTAINS[cd] %@", "1")
]),
NSCompoundPredicate(andPredicateWithSubpredicates: [
NSPredicate(format: "entity = %@", Tag.entity()),
NSPredicate(format: "name CONTAINS[c] %@", "tag")
])
])
Now, this yields another problem: there is no API to limit the number of entities to fetch “per group”.
If you do need this feature, you’re probably better of with multiple NSFetchRequest(s).