Home > Files & Folders >
Creating Advanced Searches

Overview

Sometimes, a simple search by a file's name or its contents won't be enough for your needs. You may wish to find files that fit a very specific set of criteria, and a simple search will be too broad for this purpose, forcing you to sift through many irrelevant files. For this reason, both Mac OS X and Windows XP let you perform complex searches in different ways.

Both operating systems let you use quotes to specify an exact phrase to search for. For instance, searching for "happy days" (with quotes) will find all files that contain that exact phrase, but will ignore files that contain the terms "happy" or "days" individually.

Mac OS X

Use the search field at the top right of any Finder window to gain access to OS X's advanced search capabilities (alternatively, you can choose Find... from the Finder's File menu). OS X provides a visual method to add/remove additional search criteria:

Click a plus button to add search criteria, or click a minus button to remove that criteria. Search results update in real time as you add/remove criteria. This screenshot shows all the different criteria that you can choose from (note: this image was created by stitching multiple screenshots together. The actual dialog is not that tall).

You can also select where to search:

  • Entire computer
  • Specific hard drive
  • Connected servers
  • Just your home directory
  • Current folder
  • Specific folders

Spotlight supports the use of keywords such as "Document", "Image", "Presentations", etc. in your searches to describe what type of files you are looking for. You can also specify time periods in your searches using keywords such as "Today", "Yesterday, "Last Week", etc.

Apple's website offers more tips on Spotlight searching.

Power User Tip: Spotlight offers command line integration for more advanced users.

You can view file metadata and even perform searches straight from Apple's Terminal application. The Terminal offers special Spotlight commands:

  • mdls - This is similar to the UNIX command ls&. Using this special command, you can list all the metadata attributes associated with a particular file.

  • mdfind - This is command tool that allows you to run searches directly from the Terminal. For example: $ mdfind “kMDItemAcquisitionModel == ‘Canon PowerShot S45’”

    This will bring up results that match this query:

    • /Users/kyle/Documents/vacation1.jpg
    • /Users/kyle/Documents/vacation2.jpg
    • /Users/kyle/Documents/vacation3.jpg
These two command-line tools can also be combined with shell scripts and AppleScripts.

Windows XP

Built-in Search

Windows XP's built-in search supports different types of complex search queries by using the "word or phrase contained in the file" box of an advanced search:

  • Free text query: This is more commonly known as a natural language query. Type in a question, and XP's search will find documents that match the meaning of your question rather than ones that contain the actual words used.
  • Example: $contents How do I print in Microsoft Excel searches for all files with that question in their contents.

  • Phrase queries: Search by a phrase ("happy days"), excluding files that contain each word in the phrase individually ("happy" or "days").

  • Alternative word queries: Search by inflected forms of the same word.

  • Example: swim** searches for "swim," "swam," and other forms of the word "swim."

  • Relational terms: Search using terms such as greater than, less than, and equal to.
  • Example: @docpagecount>7 searches for every document with a page count greater than seven.

For more in-depth reading on XP's indexing's abilities, refer to this MSDN page about indexing (XP uses Indexing Service 3.0), or refer to isconcepts.chm, located in your Windows\Help\ folder.

Windows Desktop Search

WDS lets you include advanced searching operators and wildcards in your queries to help you refine the scope of the items you're looking for. Advanced searches are performed by either entering keywords and search terms in any search view, or using a few options of the full search windows to further narrow down your results. In addition to using quotes for exact phrases, here are some other special ways you can refine your search:

  • Parentheses: By surrounding two or more keywords in parentheses, you can tell WDS to look for files that contain both of those terms, but not necessary together.
  • Example: (one two) will look for any files containing both the word "one" and the word "two."

  • Logical operators: Supported logical operators are AND, OR, and NOT. These must be in capital letters; otherwise, WDS will assume you are looking for the actual word. When typing two or more keywords together, WDS will automatically include the logical operator AND in between them. You can reverse this behavior by typing a minus sign in front of a keyword. This will cause WDS to display files that do NOT have this keyword in it.

    You can combine any of the terms together into one query, except for the logical AND and NOT operators (because they would cancel each other out).

  • Example: Peaches AND "Cream OR Apple" will return any files that contain "Peaches" and any files that contain either the words "Cream" or "Apple"

  • Wildcards: The asterisk symbol (*) is a "wildcard" character that can be used as a placeholder in your searches to represent anything.
  • Example: *.jpg will return all results that contain .jpg in the file. Dan*Pouliot will find any files that contain both the keywords "Dan" and "Pouliot," no matter what other information falls between them.

  • True/False: These operators can be used to determine if a specific condition is met or not. They make heavy use of a file's metadata properties, which are fully listed on this page. There are two ways to do a search using true/false queries:
  • has:[insert keywords here]:true/false is used to search through files that have a certain property in either their metadata or content assigned to them. You can leave off the :true part as WDS will assume you want to do a search for the statement being true.

    is:[insert keywords here]:true/false is used to specify the type of file you are or are not searching for ("attachment" will search for all e-mail attachments)

    Examples:

    has:attachment will find any files with an attachment (has:attachment:true would return the same results).
    is:attachment:false will search through all files and only show the files that are not attachments. It will not include files that contain attachments.

  • Date: You can refine your search results by specifying a time frame for the files you are looking for. You can display all the files that were created/modified before or after a particular date.
  • Examples:

    before:1/1/2005 will find everything before the date 1/1/2005.
    after:1/1/2005 will find everything after the date 1/1/2005 (note: you can search by just a date, but there's no keyword for that).

  • File Properties: WDS allows you to search using keywords based on certain metadata properties from your files.
  • Example: author:Dan will find all files authored by Dan. Some common properties are author, name, and extension. MSN provides a full list of the different types of metadata you can search for using WDS.

There are various categories one can search by (seen below). Search results will contain "standard" columns as well as columns customized to the category you selected. This includes the name, date, size, and containing folder. Each category also contains columns that relate to that specific sort of file. For example, music files will contain columns for duration, genre, artist, etc. (although images do not contain columns for obvious data like dimensions).

Each item has a special context menu. For results other than those specific to Outlook or Outlook Express (that is, emails, attachments, meetings, tasks, and notes) there is one additional menu item: "open containing folder." This will open up the folder on your hard drive that contains the selected file.

The Outlook and Outlook Express items have their own special context menu (seen below). For instance, items in these menus include the option to open up Outlook Express to reply back to a message. Options to search for information related to the selected email are very useful as well. For example, if you search for an email contained in a thread, you can choose "Show Conversation" from that email's context menu, which will open up a new window showing the complete thread. You can also use this context menu to search for all emails by the same author or date as the one you have selected.


Conclusion

Mac OS X
  • Making selections visually to refine search is easily learned
  • Making selections visually is occasionally less powerful than text queries
  • There is no NOT operator. Although the Finder's advanced search lets you use "Name" as additional criteria (along with the options "Contains," "Begins With," "Ends With," and "Is"), "Does Not Contain" is not an option
  • The Finder's advanced search does not search email messages
XP:
  • Query language can lead to powerful results
  • WDS results will show you a “Google-style” brief excerpt from a document
  • Query language may be too "advanced" for some users to learn
  • No ability (in WDS) to group and sort within groups (just sort)
  • No discreet separators between sort sections

Mac OS X and Windows XP take two different approaches to advanced searching. XP's built-in search and WDS both require the user to generate a query string, whereas Spotlight lets the user select search criteria from choices displayed visually. XP's method is arguably more powerful, but it suffers from being more difficult to use than Spotlight (since users will need to learn how to use different special characters to create a complex query). OS X users can simply point and click to create a complex query.

Mac OS X: 8
Windows XP: 5 (7)

Back Customizing Search Behavior | Next Saving Searches