Go Back   The macosxhints Forums > OS X Help Requests > Applications



Reply
 
Thread Tools Rate Thread Display Modes
Old 11-19-2007, 07:51 PM   #1
m021478
Major Leaguer
 
Join Date: Jul 2005
Posts: 364
Manual Specify your search 'Path' using Spotlight Boolean query??

Does anyone know if its possible to manually enter in a Boolean query specifying the path of that you would like to search into spotlight (using Spotlight on Leopard)? Apple's help documentation offers the following suggestions, but nothing related to specifying the path of a search:

Quote:
trip kind:document searches for the word “trip” in documents only

author:tom searches for all items written by Tom

meeting date:tomorrow searches for meetings you have planned for tomorrow

kind:images created:5/16/07 searches for images created on a specific date

kind:music by:”glenn miller” searches for music by Glenn Miller

modified:<=6/29/07 searches for items modified on or before a specific date

Boolean query

A Boolean query is a search that uses AND, OR, and NOT (known as Boolean operators) to narrow results. You can also use a dash (-), meaning AND NOT, to exclude items when you search. Here are examples of what you might type in the search field when you search using Boolean operators:

author:tom AND author:thom searches for items authored by Tom and Thom, in case you don’t know the exact spelling of his name

trip -france searches for items that contain the word “trip” but not “france,” so results might include photos from a trip to Spain but not to France

kind:messages date:6/29/07-7/25/07 NOT date:7/14/07 searches for email messages dated from 6/29/07 through 7/25/07, but excludes those dated 7/14/07

I ask because I am trying to use such a feature in conjunction with Microsoft Expression Media (former iView Media Pro), as seen here:



I've tried strings such as the following, but have not had any luck as of yet...



Any suggestions would be greatly appreciated... Thanks!

Last edited by m021478; 11-19-2007 at 08:02 PM.
m021478 is offline   Reply With Quote
Old 11-20-2007, 05:16 PM   #2
macosnoob
MVP
 
Join Date: Jan 2007
Posts: 1,872
Path is one of those metadata elements explicitly unqueryable via a Spotlight search:

kMDItemPath
Complete path to the file. This value of this attribute can be retrieved, but can't be used in a query or
to sort search results. This attribute canít be used as a member of the valueListAttrs array parameter
for MDQueryCreate or MDQueryCreateSubset.
Value Type: CFString
Framework Path: CoreServices/CoreServices.h
Header: MDItem.h
Availability: Available in Mac OS X v10.4 and later.

Spotlight Metadata Attributes Reference,
http://developer.apple.com/documenta...Ref/index.html

So I doubt that you can construct any Boolean string in Spotlight that will get you where you want to go.

Would a Cmd-F Find specifying the path to target under "Others" (next to Servers / Computer / Home in Tiger's Cmd-F Find window) along with some Raw Query elements to specify kMDItemContentType and kMDItemContentCreationDate achieve the desired result? That's what I'd do in Tiger. (I don't know how Leopard may have changed things.) Something along the lines of a Raw Query of

(kMDItemContentType = public.tiff) && (kMDItemContentCreationDate > $time.iso(20070201)) && (kMDItemContentCreationDate < $time.iso(20070514))


with "Others" pointing to the target directory.

You could save the search to a SmartFolder, then extract the query string (Cmd-I on the SmartFolder will show it)--that <i>does</i> reference the path you've selected under "Others"--and try dropping it in Microsoft Expression Media search box. No idea if it will work.
macosnoob is offline   Reply With Quote
Old 11-20-2007, 10:19 PM   #3
Hal Itosis
Hall of Famer
 
Join Date: Apr 2002
Posts: 3,315
Quote:
Originally Posted by macosnoob
Path is one of those metadata elements explicitly unqueryable via a Spotlight search:
:
:
:
You could save the search to a SmartFolder, then extract the query string (Cmd-I on the SmartFolder will show it)--that <i>does</i> reference the path you've selected under "Others"--and try dropping it in Microsoft Expression Media search box. No idea if it will work.

Interestingly enough, the command-line equivalent -- mdfind -- *does* have a switch for that:

[-onlyin directory]
Limit the scope of the search to the directory specified.

So, specifying a path is as simple as:

mdfind -onlyin ~/Documents quibble

/Users/halito/Documents/TidBITS collection/TidBITS#884-18-Jun-07


There must be some way to work that in the GUI.

-HI-

Last edited by Hal Itosis; 11-20-2007 at 10:24 PM.
Hal Itosis is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 12:01 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.