Query syntax

Use these confirmed rules when writing the query string in the Risk Tool.

Boolean logic

SyntaxMeaningExample
ORMatch any term or phrase.inflation OR pricing
,Also means OR.inflation, pricing
ANDRequire all terms or phrases in the same sentence.inflation AND margin
AND NOTExclude a term or phrase.silicon AND NOT valley
&Shorthand for AND.inflation & margin

The query parser recognizes Boolean words case-insensitively, but uppercase is clearer to read and is used throughout these docs.

The pipe character (|) works as shorthand for OR, for example inflation | pricing.

Use AND NOT with a single term or phrase. Prefer:

a AND NOT b AND NOT c

instead of:

a AND NOT (b OR c)

Precedence

Parentheses group first. AND and AND NOT are evaluated before OR and comma.

QueryMeaning
a OR b AND ca OR (b AND c)
a AND b OR c(a AND b) OR c
(a OR b) AND c(a AND c) OR (b AND c)

Parentheses must balance.

Quotes and phrases

A bare multi-word term is treated as a phrase:

supply chain

Use quotes when a phrase contains reserved syntax:

"R&D" OR "margin, pressure" OR "research and development"

Case sensitivity

An unquoted query string is case-insensitive.

A quoted query string respects capitalization. For example, "Motor" is distinct from motor. Keep this side effect in mind when quoting a phrase only to escape reserved characters.

Punctuation

These characters are reserved outside quotes:

, ( ) & | ! * ?

Quote literal uses of reserved syntax, such as "R&D" or "AT&T".

Other punctuation such as -, /, ., +, and : is passed through by the web parser. Do not assume punctuation variants normalize automatically. Use OR variants when needed.

Plurals and wildcards

There is no documented automatic stemming or plural expansion in the app parser.

Use * for zero or more characters up to a word boundary:

invest*

Use ? for zero or one character:

investment?

For irregular or risky matches, enumerate terms manually:

company OR companies

Weighted dictionary queries

Two special forms use a weighted dictionary instead of a keyword query string. They reproduce established measure families from the academic literature: firm-level political risk (Hassan, Hollander, van Lent, and Tahoun) and country risk (Hassan, Schreger, Schwedeler, and Tahoun).

FormShorthandExample
POLITICAL RISK: <topic code>PR: <topic code>PR: T_TRADE
COUNTRY RISK: <country code>CR: <country code>CR: BR

Political-risk topic codes are PR (overall political risk), NPR (non-political risk), and eight topic variants: T_ECON (economy), T_ENV (environment), T_TRADE (trade), T_INST (institutions), T_HEALTH (health), T_SEC (security), T_TAX (tax), and T_TECH (technology).

Country codes are two-letter codes. The 45 largest economies covered in the source country-risk paper are available:

AR AU BE BR CA CH CL CN CO CZ DE EG ES FR GB
GR HK HU ID IE IL IN IR IT JP KR MX MY NG NL
NO NZ PH PK PL RU SA SE SG TH TR TW US VE ZA

(CR is Costa Rica's country code, but Costa Rica is not among the available countries. After the CR: prefix, the two letters are always read as the target country.)

An optional trailing number restricts the dictionary to its highest-weighted terms:

PR: T_TAX: 500

Use a weighted form as the entire query string, without other terms or Boolean operators. Running it reports weighted values instead of plain sentence counts. See Weighted measures for what changes and what the output means.

Was this page helpful?