2.2.13.1 Common Definitions

The first definitions are a set of basic definitions that are used throughout the rest of the description of the SharePoint Search SQL syntax:

 ws           =  %x09 / %x20 / %x0A / %x0D
                   ; tab, space, line feed, carriage return
 lowalpha     =  %x61-7A
 upalpha      =  %x41-5A
 alpha        =  lowalpha / upalpha
 digit        =  %x30-39
 alphanum     =  alpha / digit

Identifiers specify the names of properties. Identifiers MUST be between 1 and 128 characters in length. There are two types of identifiers, regular identifiers and delimited identifiers. Regular identifiers MUST be formed from a limited set of characters and begin with a letter whereas delimited identifiers can contain any Unicode character. Regular identifiers MUST NOT be one of the keywords in SharePoint Search SQL syntax. An identifier that is also a keyword in SharePoint Search SQL syntax MUST be expressed using a delimited identifier. Delimited identifiers MUST be surrounded by double quotes. To use a double quote as part of a delimited identifier, it MUST be encoded as two double quotes in succession. Content is a special identifier. It MUST refer to a property that represents the body of the crawled items. Finally, aliases are regular identifiers that begin with a pound sign.

 identifier             =   regular-identifier / delimited-identifier
 regular-identifier     =   alpha *127identifier-char
 identifier-char        =   alphanum / "_"
 delimited-identifier   =   %x22 1*128quoted-dquote-char %x22
                                        ; %x22 is double quote
 quoted-dquote-char     =   %x00-21 / %x22.22 / %x23-%x10FFFF
                                 ; %x22 is double quote
 alias-name             =   "#" regular-identifier

An implementation of the SharePoint Search SQL syntax MUST support various kinds of literals. One of these is the string literal. While string literals MUST NOT be limited in their length, they are limited by the length of the overall SharePoint Search SQL query. They can contain any Unicode character. They MUST be enclosed in single quotes. To use a single quote as part of a string, it MUST be encoded as two single quotes in a succession.

 string= "'" *quoted-quote-char "'"
 quoted-quote-char=%x00-26 / "''" / %x28-%x10FFFF
     ; single quote is %x27

Numeric literals represent numbers, including positive and negative integers expressed in decimal or hexadecimal, as well as floating point values, including exponential notation using the character ‘e’.

 positive-decimal        =   1*digit
 negative-decimal        =   "-" positive-decimal
 decimal                 =   positive-decimal / negative-decimal
 hex-digit               =   digit / %x41-46 / %x61-66; digits and a-f
 positive-hex            =   "0x" 1*hex-digit
 negative-hex            =   "-" positive-hex
 hex                     =   positive-hex / negative-hex
 positive-float          =   1*digit ["." *digit] / "." 1*digit
 negative-float          =   "-" positive-float
 positive-float-exp      =   positive-float ["e" 1*digit]
 negative-float-exp      =   "-" positive-float-exp
 float                   =   positive-float-exp / negative-float-exp

Boolean literals represent logical values and MUST be either "TRUE" or "FALSE":

 boolean="TRUE" / "FALSE"

Date literals represent specific dates or times. They MUST be enclosed in single quotation marks, and they MUST be in the form year/month/day or year-month-day. The year MUST be specified as a four-digit value. Time values MUST be in the form hours:minutes:seconds. The protocol server MUST interpret concatenated date and time values as a timestamp value.

 year                   =   4digit
 month                  =   [digit] digit
 day                    =   [digit] digit
 hour                   =   [digit] digit
 minute                 =   [digit] digit
 second                 =   [digit] digit
 date-date              =   year "/" month "/" day
 date-date              =/  year "-" month "-" day
 date-time              =   hour ":" minute ":" second
 date-value             =   date-date [1*ws date-time]
 date                   =   "'" date-value "'"

CONTAINS Predicate and FREETEXT Predicate allow specifying a language for a token or a phrase. In the SharePoint Search SQL syntax, languages MUST be specified by an LCID.

 lcid                   =   decimal / hex

For Literal Predicate, an implementation of the SharePoint Search SQL syntax MUST support the following comparison operators:

 operator               =   "=" / "!=" / "<>" / ">" / ">=" / "<" / "<="