:ex1, "pets" AND "cat" OR "dog" #
- The precedence of the logic operators is, in order of decreasing precedence: NOT, AND, XOR, OR.
- Parentheses can be used to group operations into a desired execution order irrespective of operator precedence.
Due to the higher precedence of AND as compared to OR, VDL ex1 from above is equivalent to:
:ex1, ("pets" AND "cat") OR "dog" #
which will match data that contains either: the word pets anywhere and the word cat anywhere; or the word dog anywhere.
If the intention is to match data containing the word pets anywhere, and either the word dog or the word cat anywhere, the VDL should be written like this instead:
:ex2, "pets" AND ("cat" OR "dog") #
which is equivalent to this more verbose form:
:ex2, ("pets" AND "cat") OR ("pets" AND "dog") #
Listen to the audio
Contents | Previous | Next