Advanced Query Syntax

The Advanced Query Syntax (AQS) is used by Windows Search to help users and programmers better define and narrow their searches. Using AQS is an easy way to narrow searches and deliver better result sets. Searches can be narrowed by the following parameters:

  • File kinds: folders, documents, presentations, pictures and so on
  • Data stores: specific databases and locations
  • Properties: size, date, title and so on
  • Contents: text like "project deliverables" or "blue suede shoes"

Furthermore, search parameters can be combined using search operators. The remainder of this section explains the query syntax, the parameters and operators, and how they can be combined to offer targeted search results. The tables describe the syntax to use with Windows Search, as well as the properties that can be queried for each file kind displayed in the Windows Search results window.

AQS Syntax

A search query can include one or more keywords, with Boolean operators and optional criteria. These optional criteria can narrow a search based on the following:

  • Scope or data store in which files reside
  • Kinds of files
  • Managed properties of files

A search query, including optional criteria described in greater detail following, has the following syntax:


["<search string>"] [<scope name>:<value>]
[<search string>] [<file kind>:<value>]
[<search string>] [<property name>:<value>] 		

Suppose a user wants to search for a document containing the phase "last quarter," created by Theresa or Lee, and that the user saved to the folder MyDocs. The query may look like this:

"last quarter" author:(theresa OR lee) foldername:MyDocs

Scope: Locations and Data Stores

Users can limit the scope of their searches to specific folder locations or data stores. For example, if you use several e-mail accounts and you want to limit a query to either Microsoft Outlook or Outlook Express, you can use store:mapi or store:oe respectively.

Restrict Search by Data StoreUseExample
Filesfilesstore:files
Outlookmapistore:mapi
Outlook Expressoestore:oe
Offline filescscstore:csc
Specific Folderfoldername, infoldername:MyDocuments
in:MyDocuments

If you have a protocol handler in place to crawl custom stores, like Lotus Notes, you can use the name of the store or protocol handler for the store. For example, if you implemented a protocol handler to include a Lotus Notes data store as "notes," the query syntax would be store:notes.

Common File Kinds

Users can also limit their searches to specific types of files, called file kinds. The following table lists the file kinds and offers examples of the syntax used to search for these kinds of files.

To Restrict by File Type:UseExample
Communicationscommunicationskind:communications
Contactscontacts, personkind:contacts
kind:person
E-mailemailkind:email
Instant Messenger conversationsimkind:im
Meetingsmeetingskind:meetings
Taskstaskskind:tasks
Notesnoteskind:notes
Documentsdocskind:docs
Musicmusic, songkind:music
kind:song
Picturespics, pictureskind:pics
Videosvideoskind:videos
Foldersfolderskind:folders
Folder namefoldername, infoldername:mydocs
in:mydocs
Programsprogramskind:programs
Recorded TVtvkind:tv
Linklinkkind:link
Journal entryjournalkind:journal

Boolean Operators

Search keywords and file properties can be combined to broaden or narrow a search with operators. The following table explains common operators used in a search query.

Keyword/SymbolExamplesFunction
NOTsocial NOT securityFinds items that contain social, but not security.
social –securityFinds items that contain social, but not security.
ANDsocial AND securityFinds items that contain both social and security.
+social + securityFinds items that contain both social and security.
ORsocial OR securityFinds items that contain social or security.
Quotation marks"social security"Finds items that contain the exact phrase social security.
Parentheses(social security)Finds items that contain social and security in any order.
>date:>11/05/04
size:>500
Finds items with a date after 11/05/04
Finds items with a size greater than 500 bytes.
<date:<11/05/04
size:<500
Finds items with a date before 11/05/04
Finds items with a size less than 500 bytes.
..date:11/05/04..11/10/04Finds items with a date beginning on 11/05/04 and ending on 11/10/04.
Note  

The operators NOT and OR must be in uppercase and cannot be combined in one query (e.g., social OR security NOT retirement).

Boolean Properties

Some file types let users search for files using Boolean properties, as described in the following table.

PropertyExampleFunction
is:attachmentreport is:attachmentFinds items that have attachments that contain report. Same as isattachment:true.
isonline:report isonline:trueFinds items that are online and which contain report.
isrecurring:report isrecurring:trueFinds items that are recurring and which contain report.
isflagged:report isflagged:trueFinds items that are flagged (Review, Follow up, for example) and which contain report.
isdeleted:report isdeleted:trueFinds items that are flagged as deleted (Recycle Bin or Deleted Items, for example) and which contain report.
iscompleted:report iscompleted:falseFinds items that are not flagged as complete and which contain report.
hasattachment:report hasattachment:trueFinds items containing report and having attachments
hasflag:report hasflag:trueFinds items containing report and having flags.

Dates

In addition to searching on specific dates and date ranges using the operators described earlier, AQS allows relative date values (like today, tomorrow, or next week) and day (like Tuesday or Monday..Wednesday) and month (February) values.

Relative to:Syntax ExampleResult
Daydate:today
date:tomorrow
date:yesterday
Finds items with today's date.
Finds items with tomorrow's date.
Finds items with yesterday's date.
Week/Month/yeardate:this week
date:last week
date:next month
date:past month
date:coming year
Finds items with a date falling within the current week.
Finds items with a date falling within the previous week.
Finds items with a date falling within the upcoming week.
Finds items with a date falling within the previous month.
Finds items with a date falling within the upcoming year.

 

Properties by File Kind

Users can search on specific properties of different file kinds. Some properties (like file size) are common to all files, while others are limited to a specific kind. Slide count, for example, is specific to presentations. The following tables list these properties by file kind.

File Kind: Everything

These are properties common to all file kinds. To include all types of files in a query, the syntax is:

kind:everything <property>:<value>

where <property> is a property listed below and <value> is the user-specified search term.

PropertyUseExample
Titletitle, subject, abouttitle:"Quarterly Financial"
Statusstatusstatus:complete
Datedatedate:last week
Date modifieddatemodified, modifiedmodified:last week
Importanceimportance, priorityimportance:high
Sizesizesize:> 50
Deleteddeleted, isdeletedisdeleted:true
Is attachmentisattachmentisattachment:true
Toto, tonameto:Henry
Cccc, ccnamecc:Vicki
Companycompanycompany:Microsoft
Locationlocationlocation:"Conference Room 102"
Categorycategorycategory:Business
Keywordskeywordskeywords:"sales projections"
Albumalbumalbum:"Hail to the Thief"
File namefilename, filefilename:MyResume
Genregenregenre:rock
Authorauthor, byauthor:"James Tiptree, Jr."
Folderfolder, under, pathfolder:downloads
File extensionext, fileextext:.txt
Tagstag, keywordtag:personal
Typetypetype:image

Contacts

These are properties common to contacts. To limit the search to contacts only, the syntax is:

kind:contacts <property>:<value>

where <property> is a property listed below and <value> is the user-specified search term.

PropertyUseExample
Job titlejobtitlejobtitle:CFO
IM addressimaddressimaddress:john_doe@msn.com
Assistant's phoneassistantsphoneassistantsphone:555-3323
Assistant nameassistantnameassistantname:Halle
Professionprofessionprofession:plumber
Nicknamenicknamenickname:Tex
Spousespousespouse:Fred
Business citybusinesscitybusinesscity:Seattle
Business postal codebusinesspostalcodebusinesspostalcode:98006
Business home pagebusinesshomepagebusinesshomepage:www.microsoft.com
Callback phone numbercallbacknumbercallbacknumber:555-555-2121
Car phonecarphonecarphone:555-555-2121
Childrenchildrenchildren:Ian
First namefirstnamefirstname:Chris
Last namelastnamelastname:Lee
Home faxhomefaxhomefax:555-555-2121
Manager's namemanagermanager:Yvette
Pagerpagerpager:555-555-2121
Business phonebusinessphonebusinessphone:555-555-2121
Home phonehomephonehomephone:555-555-2121
Mobile phonemobilephonemobilephone:555-555-2121
Officeofficelocationofficelocation:BldgA/Rm101
Anniversaryanniversaryanniversary:1/1/06
Birthdaybirthdaybirthday:1/1/06
Web pagewebpagewebpage:www.microsoft.com
Note  

Phone numbers are indexed as entered. For example, if a user did not include a country or area code when entering the phone number, users will not be able to locate a contact if searching with country or area code in the phone number.

Communications

These are properties common to communications. To limit the search to communications only, the syntax is:

kind:communications <property>:<value>

where <property> is a property listed below and <value> is the user-specified search term.

PropertyUseExample
Fromfrom, organizerfrom:Marshall
Receivedreceived, sentsent:yesterday
Subjectsubject, titlesubject:"Quarterly Financial"
Has attachmenthasattachments, hasattachmenthasattachment:true
Attachmentsattachments, attachmentattachment:presentation.ppt
Bccbcc, bccname, bccaddressbcc:Jackson
Cc addressccaddress, ccccaddress:john_doe@hotmail.com
Follow-up flagflagstatusflagstatus:unflagged
flagstatus:followup
flagstatus:completed
Due dateduedate, duedue:last week
Readread, isreadisread:false
Is completediscompletediscompleted:true
Incompleteincompleteincomplete:true
Has flaghas:flag, isflaggedhas:flag
isflagged:true
Durationdurationduration:> 120

Calendar

These are properties common to calendars. To limit the search to calendars only, the syntax is:

kind:calendar <property>:<value>

where <property> is a property listed below and <value> is the user-specified search term.

PropertyUseExample
Recurringrecurring, is:recurringis:recurring
recurring:true
Organizerorganizer, by, fromorganizer:Theresa
Locationlocationlocation:ConfRoomA

Documents

These are properties common to documents. To limit the search to documents only, the syntax is:

kind:documents <property>:<value>

where <property> is a property listed below and <value> is the user-specified search term.

PropertyUseExample
Commentscommentscomments:"needs final review"
Last saved bylastsavedbylastsavedby:Doug
Document managerdocumentmanagerdocumentmanager:Sherri
Revision numberrevisionnumberrevisionnumber:1.0.3
Date last printeddatelastprinteddatelastprinted:last week
Slide countslidecountslidecount:>20

Presentation

These are properties common to presentations. To limit the search to presentations only, the syntax is:

kind:presentation <property>:<value>

where <property> is a property listed below and <value> is the user-specified search term.

PropertyUseExample
Slide countslidecountslidecount:>20

Music

These are properties common to music files. To limit the search to music only, the syntax is:

kind:music <property>:<value>

where <property> is a property listed below and <value> is the user-specified search term.

PropertyUseExample
Bit ratebitratebitrate:192
Artistartist, byartist:"Golden Palominos"
Durationdurationduration:3
Albumalbumalbum:"Greatest Hits"
Genregenregenre:rock
Tracktracktrack:12
Yearyearyear:> 1980 < 1990

Picture

These are properties common to pictures. To limit the search to pictures only, the syntax is:

kind:picture <property>:<value>

where <property> is a property listed below and <value> is the user-specified search term.

PropertyUseExample
Camera makecameramakecameramake:sample
Camera modelcameramodelcameramodel:sample
Dimensionsdimensionsdimensions:8X10
Orientationorientationorientation:landscape
Date takendatetaken, takendatetaken:yesterday
Widthwidthwidth:1600
Heightheightheight:1200

Recorded TV

These are properties common to recorded tv. To limit the search to recorded tv only, the syntax is:

kind:tv <property>:<value>

where <property> is a property listed below and <value> is the user-specified search term.

PropertyUseExample
Broadcast datebroadcastdatebroadcastdate:2005
Channel numberchannelchannel:7
Closed captioningclosedcaptioningclosedcaptioning:true
Date releaseddatereleaseddatereleased:2005
Episode nameepisodenameepisodename:sample

Video

These are properties common to videos. To limit the search to videos only, the syntax is:

kind:video <property>:<value>

where <property> is a property listed below and <value> is the user-specified search term.

PropertyUseExample
Namename, subjectname:"Family Vacation to the Beach 05"
Extext, fileextext:.avi

The example companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted herein are fictitious. No association with any real company, organization, product, domain name, e-mail address, logo, person, places, or events is intended or should be inferred.

Show: