Boolean queries involve the following special operator expressions:
xANDy - both x and y must match in the result.
xORy - either x or y must match in the result.
NOTx - x must not match in the result.
In these queries, x
and y
can be either simple terms or expressions, which together form a complex Boolean expression. Parentheses are used to clarify the syntax of complicated queries, such as
x and (y or z)
Some search engines often conceal this syntax by providing several Boolean fields for input:
ALL - all of the terms entered must appear in the result; a logical AND of all of the entered terms
ANY - one of the terms entered must appear in the result; a logical OR of all of the entered terms
NONE - none of the terms entered must appear in the result; a logical NOT of all of the entered terms
Another approach is to simplify the Boolean syntax and limit the expressive power to make it easier for end-users to master. This simple Boolean syntax typically has just two operators:
+term - term is required in the result
-term - term must not be in the result, also known as term exclusion
These simple operators can approximate more complex full Boolean syntax. For example, x AND y could be entered as +x +y. x AND NOT y could be entered as +x -y. x AND (y OR z) could be entered as +x y z, assuming the search engine defaults to a Boolean OR of terms. The behavior may not be exactly the same, and depends greatly on the search engine, but this syntax is clearly a simple and effective alternative to full Boolean expressions.
ATG Search can be configured to use both forms of Boolean syntax and has extended some of the syntax to adapt to its two-level index. The relevant query operators are described in the User-Entered Query Operators chapter.