Examples of Operator Use
The following examples illustrate the use of the Boolean and proximity operators.
| To Search For | Example | Results |
|---|---|---|
|
Both terms in the same document. |
red AND dog —Or— red & dog |
Documents with both the words red and dog. |
|
Either term in a document. |
red OR dog —Or— red | dog |
Documents with either of the words red or dog. |
|
The first term without the second term. |
red AND NOT dog —Or— red & ! dog |
Documents with the word red but not dog. |
|
Several terms in the same document, close together. |
red {NEAR dist = 50, unit = word} dog {NEAR dist = 50, unit = word} cat —Or— red NEAR dog NEAR cat —Or— (red ~ dog) ~ cat |
Documents with the word red near the word dog and that combination near the word cat. |
|
Several terms in the same document, but not others close together. |
(red OR dog) AND NOT (black {NEAR dist = 50, unit = word} cat) —Or— (red OR dog) AND NOT (black NEAR cat) —Or— (red | dog) &! (black ~ cat) |
Documents with the word red or the word dog, but not the word black near the word cat. |
|
Documents not matching a value-type property. |
NOT @size = 100 —Or— ! @size = 100 |
Documents that are not 100 bytes. |