Boolean operators help define the logical relationship among multiple search terms and phrases. Boolean search logic is executed by using the operators AND, OR, or NOT between each search term or phrase. It is important to understand when to use each boolean operator and how to construct compound boolean syntax to get the most out of your search.
AND is best used to narrow search results by requiring all of the search terms or phrases in the query to occur in each record returned. For example:
COPD AND “lung disease”
The above search requires that the records returned contain both the search term and search phrase.
Conversely, OR is best used when you want to do a broad search about related topics. Each of the results returned will include one, several, or all of the search terms or phrases included in the query. Use the OR operator when it is not necessary for all terms or phrases to occur in each of the resulting records. For example:
“lung disease" OR COPD OR “lung cancer”
The above search will return records where at least one of the search terms or phrases occurs in the records returned. Not all terms or phrases have to occur in the records returned, however, results are sorted by relevance, meaning records that contain a higher number of the search terms or phrases, or have a higher quality match for the fields searched, will be returned higher in the results list. For more information see the Relevance section.
NOT is best used when searching for a topic that often co-occurs with another topic that you wish to exclude. The NOT operator can be implemented in one of two ways, either by using the boolean operator NOT or by using the minus sign ( - ) directly in front of the term or phrase to be excluded. For example:
(COPD OR “lung disease”) NOT asthma
Alternatively:
(COPD OR “lung disease”) -asthma
The above search will return records containing either COPD or lung disease while excluding records containing the search term asthma.
You can control the order your search terms and phrases are searched by using parentheses to group search terms and phrases. Just like in math, the terms or phrases contained inside of parentheses are considered together. Likewise, nested parentheses are considered from the inside out. For example:
(“lung cancer” AND (COPD OR “lung disease”)) NOT asthma
The above search will first consider the inner set of parentheses, COPD OR lung disease, finding records that contain both the search term and search phrase, or just one of them. Of those records, only records containing lung cancer will be retained. Finally, of the remaining records, any records that contain the search term asthma will be excluded from the results returned.
Parentheses give you a lot of control over your search syntax. When using parentheses make sure there is an opening and closing parenthesis in the appropriate places to ensure proper execution. If your results are not what you expected when using compound boolean syntax, review your query and make sure the appropriate terms or phrases are grouped together, remembering the inside out rule, and that each set of parentheses has an opening and closing parenthesis.
A closely related query syntax technique is minimum should match. View the Minimum Should Match section for more information.