Or qualifier (including a many-to-many 'containsObject') give wrong results
Or qualifier (including a many-to-many 'containsObject') give wrong results
- Subject: Or qualifier (including a many-to-many 'containsObject') give wrong results
- From: Mark Gowdy <email@hidden>
- Date: Thu, 17 May 2012 18:17:58 +0100
Hi,
I have a 'Media' entity, and a 'Category' entity. I need to create a qualifier that queries on 2 'to-one' relationships, as well as on a single 'to-many'.
These are some test qualifiers and the number of distinct results they got:
EOQualifier q1 = Media.PRIMARY_CATEGORY.eq(cat).or(Media.SECONDARY_CATEGORY.eq(cat)); // result count = 16 (correct) // EOQualifier q2 = Media.OTHER_CATEGORIES.containsObject(cat); // result count = 11 (correct) // EOQualifier q3 = Media.PRIMARY_CATEGORY.eq(cat).or(Media.SECONDARY_CATEGORY.eq(cat)).or(Media.OTHER_CATEGORIES.containsObject(cat)); // result count = 15 (WRONG, should be 27) // // Another way EOOrQualifier q4 = new EOOrQualifier(new NSArray( new EOQualifier[] {q1,q2 } )); // result count = 15 (WRONG)
In the past, I worked around the problem by doing two separate fetches and combining the results. But I would like to do it in one. So, any ideas how can I get 'q3' to work?
The main reason for fixing this, is that I need to combine a few of these with a larger AND qualifier, and some of the intermediary qualifiers are likely to have LOTS of results.
Regards,
Mark
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden