spotlight-dev

[Prev] Thread [Next]  |  [Prev] Date [Next]

some operators don't work with NSMetadataQuery? John C. Daub Mon Apr 27 12:12:14 2009

Hello.

I'm working with NSRuleEditor, which utilizes NSPredicate, which ultimately
gets fed to an NSMetadataQuery.

I create my predicate (by returning parts from NSRuleEditor's
-ruleEditor:predicatePartsForCriterion:withDisplayValue:inRow: delegate
method), and in some cases there's failure to accept the predicate. I'm
trying to figure out why.

The GUI is trying to specify "name matches/contains/begins/ends/is" <value>

When I use "matches", the -description of the NSPredicate is:

    kMDItemDisplayName MATCHES "foo"

and when I [myNSMetadataQuery setPredicate:myPredicate] it generates the
error:

    NSMatchesPredicateOperatorType NSComparisonPredicate not allowed to
    NSMetadataQuery (kMDItemDisplayName MATCHES "fred").

If I try "contains", the predicate is:

    kMDItemDisplayName CONTAINS "foo"

and I get an error of:

    Unknown type of NSComparisonPredicate given to NSMetadataQuery
    (kMDItmeDisplayName CONTAINS "fred")

"Is", "begins with", and "ends with" all work out fine.


What am I doing wrong?

-- 
John C. Daub }:-)>=
<mailto:[EMAIL PROTECTED]> <http://www.hsoi.com/hsoi/blog/>
"A little nonsense now and then
is relished by the wisest men." -- Willy Wonka


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Spotlight-dev mailing list      ([EMAIL PROTECTED])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/spotlight-dev/alexiscircle%40gmail.com

This email sent to [EMAIL PROTECTED]