Example Queries

Note  Indexing Service is no longer supported as of Windows XP and is unavailable for use as of Windows 8. Instead, use Windows Search for client side search and Microsoft Search Server Express for server side search.
 

The following table illustrates several example queries. The examples for the short form of Dialect 2 generally apply to Dialect 1 with the exception of the incompatibilities noted in Incompatibilities of Dialect 2 with Dialect 1.

ExampleVersionResults
{prop name=Contents} apple tree {/prop}Dialect 2Documents with the phrase apple tree.
{phrase} apple tree {/phrase}Dialect 2Documents with the phrase apple tree.
"apple tree"Dialect 2, short formDocuments with the phrase apple tree.
apple treeDialect 2, short formDocuments with either or both of the words apple and tree.
apple treeDialect 1Documents with the phrase apple tree.
apple {near dist=50, unit=word} treeDialect 2Documents with the words apple and tree within 50 words of each other.
Microsoft near release and {prop name=rank} > 0Dialect 2Documents containing the words Microsoft and release occurring near each other.
Microsoft ~ release & @rank > 0Dialect 2, short form, or Dialect 1Documents containing the words Microsoft and release occurring near each other.
$contents Why is the sky blue?Dialect 2, short form, or Dialect 1Documents that match the free-text query (which are about the blue sky).
@size > 1000000 & < 2000000Dialect 2, short form, or Dialect 1Documents larger than 1 million bytes but smaller than 2 million bytes.
{prop name=size} > 1000000 & < 2000000Dialect 2Documents larger than 1 million bytes but smaller than 2 million bytes.
@attrib ^s 32Dialect 2, short form, or Dialect 1Documents with the archive attribute bit on.
@all Excel & ( @size > 1000 & < 100000 ) & MicrosoftDialect 2, short form, or Dialect 1Documents containing the words Excel and Microsoft that are between 1,000 and 100,000 bytes in size.
{prop name=all} Excel and {prop name=size} > 1000 and < 100000 ) {/prop} and MicrosoftDialect 2Documents containing the words Excel and Microsoft that are between 1,000 and 100,000 bytes in size.
@Write > -2dDialect 2, short form, or Dialect 1All documents changed within the last two days.
@Write > 2000-1-1Dialect 2, short form, or Dialect 1All documents on or after the year 2000.
@filename = *.aviDialect 2, short form, or Dialect 1Video files. The = indicates the query contains an MS-DOS/Windows wildcard character.
#filename *.aviDialect 2, short form, or Dialect 1Video files. The # prefix indicates the query contains a regular expression.
#filename *.|(do?|,xl?|,p?t|,mdb|)Dialect 2, short form, or Dialect 1Microsoft Office documents.
{prop name=filename} {regex}*.|(do?|,xl?|,p?t|,mdb|){/regex}Dialect 2Microsoft Office documents.
#path "*\|[^\]|[14,|}\*"Dialect 2, short form, or Dialect 1Paths with a directory component containing fourteen or more characters.
{prop name=path}{regex}"*\|[^\]|[14,|}\*"{/regex}Dialect 2Paths with a directory component containing fourteen or more characters.
{generate method=prefix} dog {/generate}Dialect 2All words beginning with dog: For example, dog, dogs, doghouse, dogma.
@contents BackOffice &! #vpath *\_vti_*Dialect 2, short form, or Dialect 1Documents containing the word BackOffice, but which are not in Microsoft FrontPage hidden directories. Microsoft BackOffice is a family of server software, designed to integrate various computer functions for businesses.
{prop name=contents} BackOffice AND NOT {prop name=vpath}{regex}*\_vti_*{/regex}Dialect 2Documents containing the word BackOffice, but which are not in Microsoft FrontPage hidden directories.
SELECT * FROM FILEINFO
  WHERE size > 1000000
SQLDocuments larger than 1 million bytes.
SELECT FileName FROM SCOPE()
  WHERE CONTAINS ('search')
    AND NOT CONTAINS ('slow')
SQLDocuments with the phrase search but not the phrase slow.
SELECT DocAuthor, DocTitle
FROM SCOPE()
  WHERE CONTAINS(DocAuthor,
         'smith')
SQLDocuments written by Smith.
...WHERE CONTAINS(DocSubject,
         '"Microsoft" 
          AND "Indexing" 
          NEAR "Service"')
SQLDocuments containing the words Microsoft and Indexing near the word Service.

 

 

 

Show: