Constructing Boolean Search Queries

The bq parameter enables you to combine matches against fields using the Boolean operators and, or, and not. When constructing Boolean search queries, you use parentheses to control the order of evaluation of the expression. When part of an expression is enclosed in parentheses, that part is evaluated first. The resulting value is used in the evaluation of the remainder of the expression. At a minimum, the entire expression must be enclosed in a single set of parentheses.

For example, to search the description field for matches that either contain the string "read" or do not contain the string "write":

../search?bq=(or description:'read' (not description:'write'))

You can use and, or, and not at the field level, and still use the - and | operators within the match expressions. For example, the following queries produce the same results:

../search?bq=(or description:'read' description:'-write')
../search?bq=(or description:'read' (not description:'write'))

For more information about using Boolean operators in match expressions, see Using Boolean Operators in Text Searches.

You can construct Boolean search queries to combine searches against multiple fields. For example:

../search?bq=(and description:'read' subject:'English')
../search?bq=(and description:'read|write' (or jurisdiction:'Arizona' jurisdiction:'California'))

Note
If you don't get the results you expect from a search request, check the match-expr in the response to see how ASN Search parsed the match expression specified in the bq parameter.