Proxycurl Ultimate Guide to Boolean Search syntax
Be an expert in Boolean for all your searches

/ proxycurl

Ultimate Guide to Boolean Search Syntax

Steven Goh
Share:

Subscribe to our newsletter

Get the latest news from Proxycurl

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.

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 Proxycurl, we decided to replace regular expressions with Boolean search because:

  1. we were getting too many support tickets from users who were tripping up on regular expressions.
  2. 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.

Supported Syntax

  1. Quotes " ": Search for an exact phrase. Using quotes around your terms (e.g., "banana bread") will return results containing that exact phrase.
  2. OR || : Use the pipe symbol to search for either term. For instance, bananas || apples will fetch results that include either "bananas", "apples", or both.
  3. AND &&: Ensure your results include all terms by using the double ampersand. A search like bananas && apples will only show results that feature both "bananas" and "apples".
  4. NOT - (hyphen): Exclude terms using the hyphen or NOT. For example, bananas -apples will return results including "bananas" but exclude any that mention "apples".
  5. Parentheses ( ): Group terms and operators to form complex queries. A search like (bananas || apples) && bread will yield results that contain "bread" and either "bananas" or "apples."
  6. Asterisk* (Not supported yet, but coming soon on Proxycurl's Search API): The asterisk acts as a wildcard. Searching for star* might return "star", "stars", "start", and so on, capturing a broader range of terms that share a root.

Crafting Your Search Queries

To make the most of boolean search syntax, consider how your query might be interpreted and structure it accordingly:

  • Be specific: Use exact phrases and conditional expressions to narrow down your search results.
  • Use parentheses: Group terms to control the order of operations, just like in mathematics.
  • Experiment with wildcards: Wildcards can help you find related terms you might not have considered.

Examples

Here are a few examples to illustrate how you might use Boolean search syntax in practice:

  • Find recipes that must include bananas but not nuts: "banana bread" -nuts
  • Research articles that mention either climate change or global warming: ("climate change" | "global warming")
  • Find documents that mention technology and either innovation or startups: technology && (innovation || startups)

Conclusion

Mastering Boolean search syntax empowers you to conduct more efficient and effective searches. By understanding and applying the principles outlined in this guide, you can navigate through information with precision, saving time and focusing on the results that matter most. Practice forming your own Boolean queries and watch how they can improve your search game. Happy searching!

Subscribe to our newsletter

Get the latest news from Proxycurl

Steven Goh
Share:

Featured Articles

Here’s what we’ve been up to recently.