OR (|)

Use the OR operator to search for documents that contain at least one occurrence of any of the query terms. The OR operator returns documents that contain any of the query terms, while the AND operator returns documents that contain all query terms.

Syntax

Syntax Description

term1|term2

term1 or term2

Returns documents that contain term1 or term2. Returns the maximum score of its operands. At least one term must exist; higher score taken.

Examples for OR Operator

To obtain the documents that contain the term cats or the term dogs, use either of the following expressions:

'cats | dogs'
'cats OR dogs'

Scoring

In an OR query, the score returned is the score for the highest query term. In the example, if the scores for cats and dogs is 30 and 40 within a document, the document scores 40.

AND (&)