There is a good chance you already know the Boolean search syntax if you're good at googling because a large of advance search expressions are in fact a Boolean search. In this guide, we will go a bit further and formally document the Boolean Search syntax.
Boolean Search Basics. Also, why Boolean Search?
At the core of Boolean search are expressions that allow you to combine or exclude keywords in specific ways, using a set of operators such as AND, OR, NOT, and more. These expressions can be simple terms, exact phrases, or a complex combination of both, structured to refine your search criteria.
At Enrich Layer, we decided to replace regular expressions with Boolean search because:
-
we were getting too many support tickets from users who were tripping up on regular expressions.
-
we looked at most regular expressions given by our users, and they are very basic queries.
What if we can have 90% of the power that regular expressions give but with a dramatically simpler learning curve? Boolean Search is the answer.
Understanding the Grammar
Let's break down the Boolean grammar that forms the backbone of this search syntax:
-
\<expression\>: This is the basic unit of your search query. It can be a single term, a conditional expression combining multiple terms, or even a group of expressions. -
\<term\>: A term can be a single word (e.g.,"banana"), an exact phrase enclosed in quotes (e.g.,"banana bread"), or an expression group, which is an expression enclosed in parentheses (e.g.,(banana OR bread)). -
\<conditional-expression\>: This involves combining terms with operators like AND, OR, NOT, and their symbolic equivalents (&&, ||, -) to refine your search.