Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.5: Add conditional Spotlight parameters to searches System 10.5
In a Spotlight search window, you can add exclusionary search parameters by holding down the Option key while clicking the add button. It changes the icon from a plus sign to three dots, and adds a line to the search query with a conditional pull-down menu, where you can select Any, All, or None. Nested below that is a standard search line. These conditional parameters can even be nested into each other. This is basically a GUI alternative to using boolean expressions in the Spotlight text search field.

This is how the Today, Yesterday, and Past Week searches that appear in the Finder's sidebar are built. They search first by time, then use a conditional line to exclude folders, presumably since folders aren't actual content but merely a way of organizing content.
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[9,130 views]  

10.5: Add conditional Spotlight parameters to searches | 7 comments | Create New Account
Click here to return to the '10.5: Add conditional Spotlight parameters to searches' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.5: Add conditional Spotlight parameters to searches
Authored by: redfood on Oct 29, '07 12:31:40PM

Now if someone could figure out how to do conditional searches in mail I wouldn't need gmail.



[ Reply to This | # ]
10.5: Add conditional Spotlight parameters to searches
Authored by: Channing Walton on Nov 09, '07 01:25:17AM

Hi, not ideal but you can create a smart folder in the finder with 'kind is mail message'. You can then use this tip to further refine it.

Channing



[ Reply to This | # ]
10.5: Add conditional Spotlight parameters to searches
Authored by: catxtwo on Oct 29, '07 12:50:39PM
It is pretty cool to examine these searches. The actual query for "Today" is:

((InRange(kMDItemLastUsedDate,$time.today,$time.today(+1)) && (!((_kMDItemGroupId = 9))))) && (true)


[ Reply to This | # ]
10.5: Add conditional Spotlight parameters to searches
Authored by: ppmax on Oct 30, '07 09:33:31PM
I have some .savedsearch(es) from Tiger which I copied to my Leopard box. Most of these savedsearches return zero results. Spotlight has indexed my drive and I didn't see any errors during mdimport. Some of my saved searches were limited to explicit directories (which are the same on both machines) and all of my savedsearches were "hand-crafted" using the Raw Query option. (I've pasted an example: see below)

I'm at a total loss as to why these wont work in Leopard. Oddly, when I double click on a savedsearch and then try to edit the query (Show Search Criteria) none of the query params or strings show up in the Finder UI.

Have there been drastic changes to the query syntax? Anyone know where I can find documentation on the new/Leopard query syntax?

Tiger savedsearch that doesnt work in Leopard:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">;
<plist version="1.0">
<dict>
<key>CompatibleVersion</key>
<integer>0</integer>
<key>RawQuery</key>
<string>(((kMDItemAcquisitionMake='*Canon*') || (kMDItemFinderComment='*Canon*') || (kMDItemAcquisitionMake='*TOSHIBA*') || (kMDItemAcquisitionMake='*OLYMPUS*') || (kMDItemAcquisitionMake='*SONY*'))) &amp;&amp; (kMDItemFSCreationDate &gt;= -63129600) &amp;&amp; (kMDItemFSCreationDate &lt; -31593600)</string>
<key>SearchCriteria</key>
<dict>
<key>CurrentFolderPath</key>
<array>
<string>/Users/paul/Pictures/Photos</string>
</array>
<key>FXCriteriaSlices</key>
<array>
<dict>
<key>FXSliceKind</key>
<string>Sraw</string>
<key>Value</key>
<string>((kMDItemAcquisitionMake='*Canon*') || (kMDItemFinderComment='*Canon*') || (kMDItemAcquisitionMake='*TOSHIBA*') || (kMDItemAcquisitionMake='*OLYMPUS*') || (kMDItemAcquisitionMake='*SONY*'))</string>
</dict>
<dict>
<key>Clock</key>
<real>-63216000</real>
<key>FXSliceKind</key>
<string>Scre</string>
<key>Value</key>
<string>DA&gt;&gt;</string>
</dict>
<dict>
<key>Clock</key>
<real>-31593600</real>
<key>FXSliceKind</key>
<string>Scre</string>
<key>Value</key>
<string>DA&lt;&lt;</string>
</dict>
</array>
<key>FXScope</key>
<integer>1396925286</integer>
<key>FXScopeArrayOfPaths</key>
<array>
<string>/Users/paul/Pictures/Photos</string>
</array>
</dict>
<key>Version</key>
<string>10.4.7</string>
<key>ViewOptions</key>
<dict>
<key>SidebarWidth</key>
<integer>135</integer>
<key>ToolbarVisible</key>
<true/>
<key>ViewHeight</key>
<integer>382</integer>
<key>ViewStyle</key>
<string>icnv</string>
<key>WindowBounds</key>
<dict>
<key>bottom</key>
<integer>546</integer>
<key>left</key>
<integer>64</integer>
<key>right</key>
<integer>814</integer>
<key>top</key>
<integer>164</integer>
</dict>
</dict>
</dict>
</plist>


[ Reply to This | # ]
10.5: Add conditional Spotlight parameters to searches
Authored by: ppmax on Oct 30, '07 09:55:47PM

Ah crap: I think I figured it out. Somehow all the <, >, =, etc chars have been converted into their xml entities/equivalents. How annoying: I wonder which app or OS was responsible for doing that?? :(



[ Reply to This | # ]
10.5: Add conditional Spotlight parameters to searches
Authored by: soundsgoodtome on Oct 31, '07 09:45:22AM
[This comment actually applies to the main article, but the "post a comment" link is missing.]

I had a difficult time getting this hint to work, for a couple of reasons. So I'm posting this for the benefit of others:

First, the phrase "In a Spotlight search window" means "In a Spotlight search *results* window" (i.e., the larger window that appears after performing a search in "little Spotlight" in the menu bar).

Secondly, the next step in the hint is "holding down the Option key while clicking the add button." I kept option-clicking the add button, but was not seeing *any* of what this hint described.

Finally, I discovered that in the Action menu (the rectangular button with the gear icon) there's an item called "Show search criteria." This feature has to be enabled (i.e., criteria showing) in order for this hint to work. I'm surprised this wasn't mentioned in the hint. Especially since it seems to be disabled by default. (Either that or some setting carried over from Tiger caused it to be disabled on my machine, preventing this hint from working.)

[ Reply to This | # ]
10.5: Add conditional Spotlight parameters to searches
Authored by: robg on Nov 06, '07 11:06:07AM

To post a new comment, use the top-level "Reply" button in the comment bar just below the article.

What you've written is not necessarily true: this hint works just fine in a normal Search, not Search Results, window. Start a new search by typing "test" or whatever in the search box. Now click the + sign to add one criteria (the Finder considers the location to be searched the first criteria). Now you'll get a second line with a + sign at the end, showing a Kind is Any search. Option click THAT plus sign, and you'll see the dots.

-rob.



[ Reply to This | # ]