Boolean operators allow conditional search results
Summarize
Summary of Boolean operators allow conditional search results
This content explains how ServiceNow customers can use Boolean operators—AND, OR, and NOT—to create more precise and conditional searches within global text search interfaces. These operators work across several search types such as the global text search field, Knowledge Base search, and list search for text.
Show less
Boolean operators are case-sensitive and must be entered exactly (e.g., OR is recognized as an operator, but or and Or are treated as plain search terms).
Key Features
- OR operator: Returns results containing any of the specified terms (union of sets). It can be used as "OR," the vertical bar symbol "|", or in condition builder filters. However, the .or. operator in filters behaves differently by separating conditions rather than combining terms in the same field.
- AND operator: Returns results containing all specified terms (intersection of sets). It is the default operator applied between terms if no other boolean operator is specified.
- NOT operator: Excludes results containing the specified term. It can be used as NOT, the minus symbol (-), or exclamation point (!), which must immediately precede the term to exclude.
- Exact phrase searches can be done using quotation marks around phrases.
- Some restrictions include the limitation to one Keywords filter condition per condition set, affecting the availability of the OR button and Keywords field in filters.
Practical Usage Notes
- Boolean operators improve search precision by allowing complex conditions to be constructed.
- The Knowledge Base search automatically switches from AND to OR if initial results are poor, and administrators can configure this behavior through system properties.
- When using NOT, it must be a standalone term and cannot exclude all terms in a search.
- Using minus (-) or exclamation point (!) requires no space between the symbol and the excluded term.
What Customers Can Expect
By applying these Boolean operators correctly, ServiceNow users can significantly refine search results to quickly find relevant records or documents. This capability enhances efficiency in navigating large data sets or knowledge bases by enabling flexible search logic tailored to specific needs.
Understanding these operators and their syntax ensures that searches behave as expected, minimizing irrelevant results and improving the overall search experience within ServiceNow.
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". |