Multiple predicates
Operators
Operators allow terms to be combined through logical operators. sensenet query language supports AND, "+", OR, NOT and "-" as Boolean operators (boolean operators must be ALL CAPS like keywords).
The OR
operator is the default conjunction operator. This means that if there is no operator between two terms, the OR
operator is used. The OR
operator links two terms and finds a matching document if either of the terms exist in a document. This is equivalent to a union using sets.
GET https://example.com/OData.svc/Root?query=Color:White OR Color:Red
The AND
operator matches documents where both terms exist anywhere in the text or fields of a single document.
GET https://example.com/OData.svc/Root?query=Color:White AND Style:Sedan
Using the + or mandatory operator is an alternative to the AND keyword. This sign must be placed in front of all terms that would be connected with the AND operator.
GET https://example.com/OData.svc/Root?query=+Color:White +Style:Sedan
The NOT
operator excludes content that contain the term after NOT
. (The Lucene engine's limitation: it cannot be used with only one term.)
GET https://example.com/OData.svc/Root?query=Color:White AND NOT Style:Sedan
The "-" or prohibit operator excludes documents that contain the term after the "-" symbol. This is the alternative of the NOT
operator.
GET https://example.com/OData.svc/Root?query=+Color:White -Style:Sedan
Grouping
sensenet query language supports use of parentheses to group clauses and form sub queries.
Following query demonstrate how you can group multiple predicates:
GET https://example.com/OData.svc/Root?metadata=no&query=Color:White AND (Style:Sedan OR Price:<10000000)