You
might not consider yourself a search ninja, but if you've typed a
keyword or two in the search box and built a point-and-click search
filter, you've taken the first steps on that path. To become a search
ninja, you must master Advanced
Query Syntax (AQS), which is the official name for the set of rules
that Windows Search follows when interpreting what you type in the
search box.
In addition to keywords, AQS supports the following types of search parameters, which can be combined using search operators:
Kinds of items Folders, documents, pictures, music, e-mail messages, and so on
Data stores Specific databases and locations containing indexed items
File properties Size, date, tags, and so on
The most basic query
typically begins with a keyword (or a portion of a word) typed in the
search box. Assuming you began typing in a location that supports
indexed searches
(the Start menu search box or your Documents library, for example), the
list of search results will include any item in that location
containing any indexed word (in its name or properties or content) that
begins with the letters you typed.
You can then narrow the
search by using additional parameters. In every case, these consist of a
word that AQS recognizes as a property or other index operator,
followed by a colon and the value for that operator. If you've used the
Search Builder to construct search filters like type:="Text Document" and size:small,
you've already seen this syntax at work. You can customize parameters
you create using the Search Builder or enter your own by typing them
directly into a search box.
It's tempting (and
wrong) to assume that the properties available as optional search
filters under the search box are the only ones permitted for that
folder. In reality, you can use any of the examples we list in this article in any search box, including the one on the Start menu. In some
contexts, a particular property might not make sense, but you can still
try. The Windows Explorer search box offers a slight aid to help you
learn the correct syntax; when you enter a recognized property or
operator followed by a colon, the text turns blue. If the property in
question supports entry from a list, the search engine begins building
that list immediately.
|
The value that
immediately follows the colon can take several forms. If you want a
loose (partial) match, just type a word or the beginning of a word.
Thus, typerofficetype:="Microsoft Office Word Document".
will turn up files of the type Microsoft Office Excel Worksheet (.xlsx)
and Microsoft Office Word 97 -2003 Document (.doc). To specify a strict
(exact) match, use an equals sign and, if necessary, quotation marks,
as in this example:
Also in this section,
we explain how you can use logical operators (AND, OR, and NOT) and
parentheses to combine criteria. If you have fond memories of MS-DOS, you'll welcome using * and ? as wildcards, and we also show how an innocuous-looking tilde (~) dramatically changes the behavior of a search.
1. Searching by Item Type or Kind
To search for files with a particular file name extension, you can simply enter the extension in the search box, like this:
*.ext
The results will
include files that incorporate the extension in their contents as well
as in their file names—which might or might not be what you want. You
will get a more focused search by using the ext: operator including an asterisk wildcard and a period, like this:
ext:*.txt
Note:
As with many properties, you have more than one way to specify an exact file name extension. In addition to ext:, you can use fileext:, extension:, or fileextension:.
File name extensions
are useful for some searches, but you'll get even better results using
two different search properties: Type and Kind. The Type property limits
your search based on the value found in the Type field for a given
object. Thus, to look for files saved in any Microsoft Office Excel
format, type this term in the search box:
type:excel
To find any music file saved in MP3 format, type this text in the search box:
type:mp3
To constrain your search to groups of related file types, use the Kind property. Table 1 lists many (but not all) of the options available with this search term.
Table 1. Limiting Items in Search Results by Kind Kind
Syntax | Returns as Search Results |
---|
kind:=calendar kind:=appointment kind:=meeting | Appointments and meetings stored in Microsoft Office Outlook, iCalendar and vCalendar files |
kind:=communication | E-mail messages and attachments |
kind:=contact kind:=person | vCard files, Windows Contact files, Outlook Contacts |
kind:=doc kind:=document | Text files, Microsoft Office documents, Adobe Acrobat documents, HTML and XML files, and other document formats |
kind:=email kind:=e-mail | Microsoft Office Outlook and Windows Live Mail messages, including messages saved as files |
kind:=folder | File folders, search folders, compressed (Zip) files, and cabinet files |
kind:=link | Shortcuts to programs and files, internet shortcuts |
kind:=music kind:=song | Windows Media playlists and audio files in MP3, WMA, or WAV format |
kind:=pic kind:=picture | Picture files in any indexed format, including JPEG, GIF, Bitmap, PNG, as well as icons and shortcuts to image files |
kind:=program | Windows
and MS-DOS applications, batch and VBScript files, saved registration
entries, Windows Installer packages, and program shortcuts |
kind:=tv | TV programs recorded by Windows Media Center |
kind:=video | Movie files and clips in any indexed format |
2. Changing the Scope of a Search
Several operators allow you to restrict a search to a particular folder or a database containing certain types
of items. For example, to search only for items in your Microsoft
Office Outlook 2007 profile, type this parameter in the Start menu
search box:
store:mapi
You can also specify a folder or library location using folder:, under:, in:, or path:. Thus, folder:documents restricts the scope of the search to your Documents library, and in:videos mackie finds all files in the Videos library that contain Mackie in the file name or any property.
Although it's not easy to do so, you can add some internet-based
locations to Windows Explorer. Search results from these locations
aren't integrated into local search results. Instead, you create a
search connector and save it as an OpenSearch file, with the .osdx file
name extension, and double-click to add it to the Favorites list in the
navigation pane. When you click the search connector, the focus moves to
the search box. Windows Explorer sends the query to the provider
defined by the Search Connector Description file, using the search terms
you entered. The results are returned as RSS or Atom feed items and
displayed in Windows Explorer in the familiar Contents view. For
technical details about the OpenSearch format, see the MSDN overview at w7io.com/0904. For a friendlier description, including links to some ready-made OpenSearch files that you can download and install for searching
popular websites, see "How to Install and Use Search Connectors in
Windows 7," by Sarah Perez of Microsoft's Channel 10 blog at w7io.com/0905.
|