AI Search query language
Summarize
Summary of AI Search query language
The AI Search query language in the Yokohama release enables ServiceNow customers to construct precise search queries using terms, phrases, and specialized operators. This allows users to efficiently find records containing specific words or phrases, apply Boolean logic, and use wildcard characters to match patterns in indexed terms.
Show less
Search query terms and phrases
- Single-term search: Find records containing exactly the specified term (e.g., conference). Substring matches are not found unless using wildcards.
- Multi-term conjunction: Search for records containing all specified terms in any order or field (e.g., conference room). If the system property glide.ais.query.searchoperator is set to OR, this behaves as a union instead.
- Quoted phrase: Find records with terms appearing consecutively and in order within the same field (e.g., "conference room"). Linguistic features and wildcards still apply inside quotes.
- Case-insensitive: Searches ignore letter case (e.g., PIN matches both PIN and pin).
- HTML/XML stripping: AI Search removes any content inside angle brackets, so queries like user <email> only search for "user".
Boolean search operators
- OR: Finds records containing any of the separated terms or phrases (e.g., "conference room" OR suite). If the system property glide.ais.query.searchoperator is set to OR, this operator has no additional effect.
- Hyphen (-): Excludes records containing the term or phrase immediately following the hyphen (e.g., email -"email signature" finds records with email but without the phrase "email signature").
Wildcard matching operators
- % (single-character wildcard): Matches any one character in an indexed term (e.g., the%e matches theme, there, these). The operator must follow at least three non-wildcard characters; otherwise, only literal matches are returned.
- (string wildcard): Matches zero or more characters in an indexed term (e.g., acc matches access, account, accuracy). Also requires at least three preceding non-wildcard characters to activate wildcard matching.
- (universal wildcard): Returns all indexed terms and records without applying relevancy ranking. Results appear in no specific order.
- Wildcard behavior: When expanding wildcard queries, AI Search ignores stop words, so wildcard expansions do not match defined stop words but still match other terms.
Practical implications for ServiceNow customers
Using this query language, customers can create targeted searches that improve the accuracy and relevancy of AI Search results. Understanding how to apply Boolean operators and wildcards helps refine queries to include or exclude specific records and match complex term patterns. The system property glide.ais.query.searchoperator influences how multi-term queries behave, giving admins control over default logical operations. Additionally, awareness of HTML/XML stripping ensures meaningful query inputs and avoids empty searches.
Learn how to construct search queries using terms, phrases, and AI Search query operators.
Search query terms and phrases
Specify terms and quoted phrases in the search query to find records that contain the same terms or phrases.
| Search query terms | Description |
|---|---|
| conference | Single-term search. Finds records that contain the term conference. Note: Search terms don't match substrings of indexed terms. As an example, searching for
exam finds records that contain the term exam, but not records that contain the term example. To search for substring matches,
you can use the % or * wildcard matching operators. |
| conference room | Conjunctive multi-term search. Finds records that contain both of the terms conference and room (an intersection of sets). The search terms can appear
in any order or proximity in the record and may appear in different fields. Note: If you set the
Boolean search operator to use when a search query includes multiple terms (
glide.ais.query.search_operator
) system property to OR query, this search finds records that contain either of the terms conference or room
(a union of sets). |
| "conference room" | Quoted phrase search. Finds records that contain the term conference followed immediately by the term room. The search terms must appear in this order and in the same field.
Note: Quoting a phrase doesn't disable linguistic features (such as normalization, synonym expansion, and stop word removal) or wildcard operators. For example, a search for the quoted phrase "email
acc*" expands the wildcard operator normally to find records that contain email account and email access. |
Boolean search operators
Separate query terms and phrases with Boolean operators to override the default matching logic for the search query.
| Operator | Description |
|---|---|
| OR | Boolean disjunction operator. Finds records that contain any of the terms or phrases separated by OR.
For example, searching for "conference room" OR suite finds records that contain the phrase conference room and records that contain the term suite. Note: If you set the
Boolean search operator to use when a search query includes multiple terms (
glide.ais.query.search_operator
) system property to OR query, this operator has no effect because search already treats all query terms and phrases as though separated by the
OR operator. |
| hyphen (-) | Boolean negation operator. Excludes records containing the term or phrase that immediately follows the hyphen.
For example, searching for email -"email signature" finds records that contain the term email but don't contain the phrase email signature. |
Wildcard matching operators
Use wildcard operators to find records that contain indexed terms matching a wildcard pattern.
| Operator | Description |
|---|---|
| % | Single-character wildcard operator. Include % in a search query term to match any one character in an indexed term.
As an example, searching for the%e finds results containing wildcard matches such as theme, there, or these. AI Search also evaluates the search with the wildcard operator ignored, to look for literal matches. The non-wildcard operator parts of the search term are treated as a phrase, meaning that
they must appear in the same order in the result as they do in the search. As an example, a search for 5000%000 returns results that contain 5000 followed by
000 as well as results that contain wildcard matches like 50007000. Note: The % operator must follow a string of three or more
non-wildcard characters. For search query terms that don't satisfy this condition, AI Search only returns literal matches. As an example, if you search for 99%, with only two non-wildcard characters preceding the % operator, AI Search only returns results with literal matches for 99. |
| * | String wildcard operator. Include * in a search query term to match any string of zero or more characters in an indexed term.
As an example, searching for acc* finds results containing wildcard matches such as access, account, accrue, accumulate, and accuracy. AI Search also evaluates the search with the wildcard operator ignored, to look for literal matches. The non-wildcard operator parts of the search term are treated as a phrase, meaning that
they must appear in the same order in the result as they do in the search. As an example, a search for 753*268 returns results that contain 753 followed by
268 as well as results that contain wildcard matches like 7539268. Note: The * operator must follow a string of three or more
non-wildcard characters. For search query terms that don't satisfy this condition, AI Search only returns literal matches. As an example, if you search for ad*, with only two non-wildcard characters preceding the * wildcard
operator, AI Search only returns results with literal matches for ad. |
| *** | Universal wildcard operator. Specify *** as a search query to find all indexed terms and thus all records. Note: AI Search doesn't apply relevancy ranking to *** queries. Results from *** queries appear in an unspecified order. |