Share via


Syntax of Query Language Dialect 1

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 EBNF production rules define the syntax of the original Indexing Service query language, Query Dialect 1. Terminal symbols are case insensitive: or, OR, Or, and oR are equivalent. The production rules give terminal symbols in lowercase only. A query containing a comma denotes a vector space query. Weight is specified using the [ Digits ] construct, where the value can be 0 to 1000.

Query =                                        (* start symbol *)

QExpression [ , Query ] ;

QExpression =

QTerm [ ( or { · }- | | ) QExpression ] ;

QTerm =

[ not { · }- | ! ] QProperty [ [ Digits ] ] [ ( and { · }- | & ) QTerm ] ;

QProperty =

( [ @ Property ] QFactor )

| ( # Property [ = ] Regex )

| ( $ Property QPhrase ) ;

QFactor =

QGroup

| ( ( Query ) )

| ( Operator [ ^a | ^s ] Phrase ) ;        (* ^a|^s only for vector properties *)

QGroup =

QPhrase [ ( near { · }- | ~ ) QGroup ] ;

QPhrase =

( Phrase [ * | ** ] )

| Regex

| ( " AnyExceptQuote " [ * | ** ] ) ;

Property =

Phrase

| ( { [ { Phrase , } Phrase ] } ) ;

Phrase =

Any                                            (* string phrase *)

| ( [ - ] Digits )                            (* integer phrase *)

| ( [ - ] Digits [ . Digits ] )            (* float phrase *)

| ( t | true | false | Any )            (* Bool phrase; Any = false *)

| DatePhrase                                (* date and time phrase *)

| ( Digits . Digits )                         (* currency phrase: dollars.cents *)

| GUIDPhrase ;                            (* globally unique identifier phrase *)

(* The following rule only prepares for the query engine, which does *)

(* the final parsing. See Pattern-Matching Queries for the full syntax. *)

Regex =

" AnyExceptQuote "

| ( ? Any character sequence preceding · ?)

| ( ? Any character sequence preceding ) not preceded by ! ? ) ;

DatePhrase =                                (* yyyy/mm/dd hh:mm:ss:msec *)

( - { Digits ( h | n | s | y | m | d | w ) }- )

| ( Digits ( / ) Digits ( / ) Digits [ · Digits : Digits : Digits [ : Digits ] ] )

| ( Digits - Digits - Digits [ · Digits : Digits : Digits [ : Digits ] ] ) ;

GUIDPhrase =

{ 0x 8 * HexDigit , 2 * ( 0x 4 * HexDigit , )

{ 0x 2 * HexDigit 7 * ( , 0x 2 * HexDigit ) } ;

Operator =

= | != | > | >= | < | <= | ^a | ^s ;

Digits =

{ DecimalDigit }- ;

DecimalDigit =

0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 ;

HexDigit =

DecimalDigit | a | b | c | d | e | f ;

Any =

? Any character sequence ? - Excluded ;

Excluded =

{ | } | ! | & | | | ~ | * | @ | # | ( | ) | [ | ] | , | = | < | > | \n | " | ^ | $ ;

AnyExceptQuote =

? Any character sequence ? - " ;        (* quoted " ( = "" ) is OK *)