I’m now trying to filter the items using the following approach:
My managed object is like that:
@interface MyManagedObject:NSManagedObject
@property (nonatomic, retain) NSString *name;
@end
For example, the name of an object is “ABCDEF GHIJKL company”
When I search with the string “BCD IJK pan” or “BCD pan”, etc,
(BCD is a substring of ABCDEF, IJK is a substring of GHIJKL, and pan is a substring of company)
it should be able to find the object.
I have no idea how to write a predicate with this. I tried to use predicateWithBlock: but Core Data doesn’t support the predicate from predicateWithBlock:
I also tried to fetch all objects first and filter the results with predicate block. But it’s extremely slow because I have around 10M objects in the Core Data.
So I would like to ask can I do this in one predicate statement? Thanks a lot!!!
You can do it with
LIKEif you include the wildcard character*. So if you search withself LIKE %@, @"*BCD*IJK*pan*it will find it