를 사용하여 일대 다 관계를 필터링 나는이 내 핵심 데이터 모델에서 다음과 같은 두 기관 :코어 데이터 - 술어
Manufacturer.manufactures <------>> Product.manufacturedBy
I :
Manufacture {name, ...other attributes}
Product {name, .... other attributes}
내가 가지고있는 설정 많은 관계로 하나 검색 문자열과 일치하는 Manufacturer에 속한 모든 제품을 반환하는 조건자를 작성하려고합니다. 예 : 두 개의 제조사, "King Nut"및 "Queen Nut"이있는 경우 "Nut"에 대한 검색은 King Nut 및 Queen Nut에서 만든 모든 제품을 반환해야합니다.
필자 내 조건자는 내 필터가 Product 엔터티에있을 때 완벽하게 작동하지만 Manufacturer 엔터티에서 필터링 할 때 어떤 조건 자도 작동하지 않습니다. 결과 세트가 비어 있습니다.
predicate = [NSPredicate predicateWithFormat:@"manufacturedBy.name CONTAINS[cd] %@",searchValue];
predicate = [NSPredicate predicateWithFormat:@"manufacturedBy.name like %@",wildcardString];
predicate = [NSPredicate predicateWithFormat:@"manufacturedBy.name matches %@",wildcardString];
predicate = [NSPredicate predicateWithFormat:@"ALL manufacturedBy.name like %@",wildcardString];
predicate = [NSPredicate predicateWithFormat:@"ALL manufacturedBy.name like[cd] %@",@wildcardString];
당신은'무엇을 의미합니까? 'Product's를 가져 오려고하면 요청 엔터티가'Product'이어야합니다 –
예. 필자의 엔터티 요청은 Product : –