How do I use the advanced keyword query in Automated Rules?
Table of Contents
Sprout’s Automated Rules help streamline message management by applying conditions to trigger specific actions. One of the most powerful and commonly used conditions is keyword-based matching.
To give you more control and flexibility when building keyword rules, Sprout offers a Boolean Query Editor. This advanced option allows you to create complex keyword criteria using Boolean logic, wildcards, proximity matching, and more. The Boolean Query Editor makes it easier to build accurate, efficient, and scalable rules.
This feature lets you enter a Lucene query directly, making it a powerful option for advanced users who are comfortable with Lucene-style search syntax.
Users will need Manage Advanced Inbox Features permission and Manage profiles & permissions access to create rules.
How to use the Boolean Query Editor
- Open or create an automated rule
-
Select the Message Criteria → matches the advanced keyword query
-
Type your custom boolean query in the editor box
-
Click the View supported query operators if you need help with supported query operators and example queries
- (If needed) combine your boolean query with other criteria using the AND/OR buttons under the query editor box
- Select the actions you wish to take for the rule
- Save your rule
Our system can handle up to about 30-40 full boolean queries combined with OR in a single rule. This is a very advanced use case and not something we generally recommend.
Supported Operators for Boolean Query Editor
Function |
Operator |
Example |
Description |
|---|---|---|---|
| multiple words | Chicago Pizza | Containing both "Chicago" and "pizza" but not as an exact phrase. The lack of "" around the phrase defaults to placing an AND between individual words | |
| exact word or phrase | "" | "Chicago pi$$a" | Containing exact phrase “Chicago pi$$a”. This is the only operator where special characters are accepted |
| both words | AND | tacos AND pizza | Containing both "tacos" and "pizza" |
| either word | OR | hotels OR motels | Containing either "hotels" or "motels" (or both) |
| exclude | NOT | "Mexican food" NOT tacos | Containing "Mexican food" but not tacos |
| exclude groups | NOT () | authentic food NOT (Italian OR Mexican) | Containing both "authentic" and "food" but not "Italian" or "Mexican" |
| exclude phrase | NOT "" or - | Social NOT "social media" Social -"social media" |
Containing "social" anywhere in the message, but not "social media" |
| complex groups | ( OR ) | (pepperoni OR mushroom) pizza | Containing either "pepperoni" or "mushroom" and "pizza" |
| complex groups | ( ) OR | (taste good) OR delicious | Containing both "taste" and "good" or "delicious |
| proximity match | ""~# | "foo bar"~4 | Containing "foo" and "bar" within 4 words of each other |
| wildcard matching | * | foo* | Containing any words that begin with "foo", such as "fool", "foolish", "fooling", etc |
Was this article helpful?