Search: Using Parentheses

 

Parentheses can be used in your search strings to provide precise control over the search.

 

For example:

 (square and dance) or carnival

 

produces different results from:

 square and (dance or carnival)

 

Here is an overview of the way Orbis evaluates search expressions with parentheses:

 

Left to Right

Within a search string, the program evaluates from left to right:

 

 (A or B and C) is evaluated as (A or B), and the result is "anded" to C.

 

Inner First

Inner clauses are evaluated before outer ones:

 

 In (A and (B or C)), (B or C) is evaluated first, and the result is "anded" with A.

 

Not

Not is always grouped with the subsequent search word or clause and simply reverses the logical sense of the result:

 

 In (A and not (B or C)), (B or C) is evaluated first, and the sense of the result is reversed, then "anded" with A.

 

Same Operators

The order of evaluation does not change the sense of the expression if all the operators are the same:

 

 (A or B or C) is equivalent to (B or A or C)

 (A and B and C) is the same as (C and A and B)

 

Different Operators

The order of evaluation is not the same if the operators are different:

 

 (A or B and C) is not the same as (B and C or A)

 

To prevent confusion, parentheses should be used to control the order of evaluation. In the absence of parentheses, the program evaluates from left to right.

 

You can have as many parentheses within a search string as you wish-that is, you can have parentheses within parentheses within parentheses, as long as the number of opening and closing parentheses is the same.

 

 

See also:

Search Strings