Re: NOT or NONE in NSPredicate
Re: NOT or NONE in NSPredicate
- Subject: Re: NOT or NONE in NSPredicate
- From: Phil <email@hidden>
- Date: Fri, 18 Jul 2008 19:17:42 +1200
On Fri, Jul 18, 2008 at 2:52 PM, Chad Harrison <email@hidden> wrote:
> I have a fairly complex NSPredicate which works correctly, but I am trying
> to compound it with with a subpredicate that contains a logical NOT. I have
> tried using many combinations of the predicate syntax, but I can't seem to
> get it working. What I am trying to do it exclude files from being picked up
> based on an NSArray of names
>
>From the content of your predicate, it looks like you're running a
Spotlight query (NSMetadataQuery), as such, the spotlight-dev list
might be a better place for this.
The Spotlight query syntax the the NSPredicate syntax aren't quite the
same, and the behind-the-scenes conversion leaves a bit to be desired.
I remember running into a situation similar to what you're trying a
while ago, and eventually giving up and construcing my own Spotlight
query strings and using MDQuery to run them.
<http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/Articles/pSpotlightComparison.html>
Do you get the error if you change your predicates to:
kMDItemFSName != %@
Some else to keep in mind is that there is (or, was the last time I
checked---10.4) an upper-limit to the length of Spotlight queries. If
this list of files is going to get BIG, then you may want to
re-consider your approach, or do the filtering after you have the
results.
Phil
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden