Boolean operators allow conditional search results
Summarize
Summary of Boolean operators allow conditional search results
Boolean operators enable ServiceNow customers to perform advanced and precise global text searches by combining search terms using logical conditions. These operators—AND, OR, and NOT—help refine search results across multiple interfaces, including the Global text search field, Knowledge Base search, and List search for text.
Show less
Key Features
- Boolean Operators Usage: Boolean operators are case-sensitive and must be used in uppercase (e.g., OR, AND, NOT) to be recognized as logical operators rather than plain text.
- OR Operator: Finds documents containing any of the specified search terms, effectively creating a union of results. It supports the vertical bar (|) symbol as an alternative. Note that using the .or. operator in field condition builders produces different results, and Keywords filters restrict the use of OR in conditions.
- AND Operator: Returns documents containing all specified search terms, acting as an intersection of sets. By default, if no operator is specified between terms, AND is applied automatically. For Knowledge Base searches, if AND yields poor results, the system retries with OR, which administrators can configure to always use via system properties.
- NOT Operator: Excludes documents containing the term immediately following NOT, the minus sign (-), or exclamation point (!). The operator must be standalone or immediately precede the excluded term without space. It cannot be used alone to exclude all terms.
Practical Implications
Understanding and applying these Boolean operators allows ServiceNow users to create complex search queries that narrow or broaden results as needed, improving the efficiency of finding relevant records or knowledge articles.
Limitations such as case sensitivity and restrictions on combining Keywords filters with OR conditions are important to consider during search query construction.
Additional Notes
- Quotation marks can be used for exact phrase searches.
- Wildcard characters enable pattern and variation searches.
- Related tasks include managing the Zing junk filter and debugging Zing search behavior.
Construct complex searches using Boolean AND, OR, and NOT operators in global text searches.
- Global text search field
- Knowledge Base search
- List search for text
| Operator | Description |
|---|---|
| OR or vertical bar symbol (|) | Finds a match if any of the search terms exist in a document (a union of sets). For example, to find documents that contain either email password or just
email, you can search for "email password" OR email or "email password"|email.
Using the .or. operator, which the system uses when you create OR condition groups for fields other than Keywords with the condition builder, can produce different results. For
example, this filter searches for records with short descriptions containing SSO and then searches separately for records with short descriptions containing
SAML: Note: By design, you can only have one Keywords filter condition per condition set. If you select the Keywords field in a filter choice list, the OR button for that filter condition becomes unavailable.
Similarly, if you construct an OR filter condition, the Keywords field becomes unavailable in the filter choice lists. |
| AND | Finds a match if all search terms exist in a document (an intersection of sets). For example, to find documents that contain both "CPU load" and "10 minutes", search for "CPU load" AND "10 minutes"
By default, Zing applies an AND operator between all search terms not separated by OR or NOT operators. For example, if you enter email server down as your search terms, the system searches
for email AND server AND down. Note: For Knowledge Base searches, if the default AND search returns poor results, the search is automatically re-run with the OR operator. Administrators can configure the knowledge base search to
always use OR by modifying the glide.knowman.search.operator system property. |
| NOT, minus (-), or exclamation point (!) | Excludes documents that contain the search term after the NOT operator (a difference of sets). For example, to find documents that contain "CPU load" but not "10 minutes", you can search for "CPU load"
NOT "10 minutes" or "CPU load" -"10 minutes" or "CPU load" !"10 minutes".
NOT must be a stand-alone term in your search. For example, atom NOT ion excludes the term ion, but NOTION searches for the term notion. The minus and exclamation point symbols must immediately precede the search term that you want to exclude. For example, a search for email !Joe excludes Joe but a search for email ! Joe includes Joe. You can't use the NOT operator to exclude all terms in your search. For example, the following search returns no results: NOT "10 minutes". |