Re: Spotlight word-based search
Re: Spotlight word-based search
- Subject: Re: Spotlight word-based search
- From: Matt Neuburg <email@hidden>
- Date: Mon, 22 May 2006 11:13:33 -0700
- Thread-topic: Spotlight word-based search
On Sun, 21 May 2006 23:04:02 +0200, Pierre Bernard <email@hidden> said:
>Things are not that easy. There are two syntaxes.
>
>In the syntax used by NSMetaDataQuery, "like" is a valid operator:
>http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/
>Articles/pSpotlightComparison.html
>Sadly this format is hardly documented. It's documented by
>anecdotical differences to the NSPredicate syntax.
(1) Your original post said nothing about NSMetaDataQuery.
(2) NSMetaDataQuery is in any case more or less irrelevant. There is only
one correct MDQuery syntax and I've already told you how to learn what the
syntax is. (Or, if you wish to experiment with the Spotlight syntax for
finding "Desktop Folder", try my free NotLight app.) Whatever
NSMetaDataQuery does, it must eventually work in terms of MDQuery. You can,
indeed, bypass NSMetaDataQuery and call MDQuery yourself (and I advise you
to do so).
(3) I am looking at the web page you cite above, and I don't see anything
that says or implies that Spotlight can take a "like" operator. I think
you're misreading the page. You can use "like" in an NSPredicate, but an
NSPredicate is not an MDQuery search string - and that fact, indeed, is
exactly what the page in question is about. For example, it says NSPredicate
can take a "like" operator, but that an MDQuery cannot.
(4) Use of [w] is not a valid NSPredicate string option. It corresponds to
no NSComparisonPredicate. So regardless of which language you want to speak
(are you going to form an NSPredicate or an MDQuery?), neither of them
permits you to say "like[wc]".
m.
>On May 21, 2006, at 5:26 PM, Matt Neuburg wrote:
>
>> On Fri, 12 May 2006 16:31:44 +0200, Pierre Bernard
>> <email@hidden> said:
>>> Hi!
>>>
>>> Could anybody venture into an explanation as to why the following
>>> Spotlight query string :
>>> (kMDItemDisplayName like[wc] 'Desktop')
>>> does not match 'Desktop Folder'?
>>
>> That would be because "like" is not a valid Spotlight query string
>> comparison operator. Correct syntax is documented here:
>>
>> <http://developer.apple.com/documentation/Carbon/Conceptual/
>> SpotlightQuery/C
>> oncepts/QueryFormat.html>
>>
>> m.
>>
>> --
>> matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
>> A fool + a tool + an autorelease pool = cool!
>> AppleScript: the Definitive Guide - Second Edition!
>> <http://www.amazon.com/gp/product/0596102119>
>>
>>
>>
>
>
>
>
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden