Mark,

I may be looking at the wrong, but don't you want an 'and' qualifier not an 
'or'?

Ted

> Date: Thu, 17 May 2012 18:17:58 +0100
> From: Mark Gowdy <go...@mac.com>
> To: WebObjects webobjects-dev <webobjects-dev@lists.apple.com>
> Subject: Or qualifier (including a many-to-many
> 'containsObject') give
>     wrong    results
> Message-ID: <8947bdf0-6370-48f5-9473-c0c206fa3...@mac.com>
> Content-Type: text/plain; charset="utf-8"
> 
> 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      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to