2.2.13.3 SELECT Statement

The SELECT statement specifies which properties to return in the search results, and how to select the search results from the crawled items. The syntax is as follows:

 SELECT properties FROM SCOPE() WHERE conditions ORDER BY sortproperties 

Both the WHERE and the ORDER BY clauses are optional. In response to a SELECT statement, the protocol server MUST return search results according to the order specified in the ORDER BY clause, or an arbitrary group of results if no sort order is specified.

 select-statement = *ws "SELECT" 1*ws properties 1*ws "FROM" 1*ws "SCOPE" *ws "(" *ws ")" *ws ["WHERE" 1*ws conditions 1*ws] ["ORDER BY" 1*ws sortproperties *ws] 

The properties component of the SELECT statement specifies which properties to return in the search results. It is simply a comma-separated list of property names that are returned by the protocol server as part of the search results if values for these properties are available. It MUST have the same effect as specifying the properties in the Query.Properties element of the QueryPacket when the value of the type attribute of the QueryText element is "STRING". All of the properties specified here MUST be retrievable properties. If any of the specified properties are not retrievable, the search query MUST fail and return an ERROR_SERVER status code.

 properties = identifier *(*ws "," *ws properties)