Within the WHERE clause, the CONTAINS function is used to embed a statement in a full-text search language. The function takes two parameters: scope and searchexp (see EBNF above)

At minimum, all implementations must support the simple search-engine syntax defined by searchexp in the EBNF above. This syntax is based on the syntax of search engines like Google.

The semantics of the simple search expression are as follows:

The scope specifies the particular property that the full-text search is to be performed on. However, support for searching on particular properties is not required. Specifying '.' indicates that the full-text search is to be done on all indexed properties of the nodes specified by the rest of the query. Only support for a scope of '.' is required.

The scope of the CONTAINS clause specifying '.' is the intersection of two sets. These two sets are:

For example, the query,

SELECT * FROM mynt:product WHERE
CONTAINS(., 'apples "good for you" –oranges')

would return a result containing all nodes of type mynt:product that have am indexed property whose value contains the string “apples”, the string “good for you” and does not contain the string “oranges”.

The relevance score for each matching node may be returned as in score column. The specification does not define the calculation of the score value, it is implementation specific.

An implementation may additionally support other embedded full-text search languages other than the simple search engine style shown here.

See also Property Constraint, jcr:contains Function and Pseudo-property.