ios - Fetching entities whose many-to-many relationship contains all terms -


i have model verse entity has many-to-many relationship word entity.

i'd find verses contain words user searching for.

i'm guessing done predicate like

    "any words.word == %@ , words.word == %@ , ...", term1, term2, ... 

can use type of word->verse index, avoid having compare every verse's words against term1?

if not, how should (model or) predicate changed make fetch more efficient?

first, can contains in 1 predicate:

[nspredicate predicatewithformat:"any words.word contains %@", arrayofwords]; 

but, slow. string compares slow. case , diacritic insensitive slowest. better off having property on word entity searching strip out case , diacritic , search against field. search performance higher.


Comments