Boolean basics: How to write a search query for newsgathering that works
First Draft uses cookies to distinguish you from other users of our website. They allow us to recognise users over multiple visits, and to collect basic data about your use of the website. Cookies help us provide you with a good experience when you browse our website and also allows us to improve our site. Check our cookie policy to read more. Cookie Policy.

This website is hosted in perpetuity by the Internet Archive.

Boolean basics: How to write a search query for newsgathering that works

Examples of Boolean searches

Smart searches cut through social media chatter by finding precise snippets of information based on keywords, dates and locations.

When searching for newsworthy content online, you’ve got to know exactly what you’re looking for and have the skills to find it.

This is where Boolean search queries help. These strings of words allow you to cut through the usual social media chatter by upgrading a default search to a multifaceted, specific search to find more precise snippets of information.

In this quick guide, we run through the basics of what you need to know to search social media for effective newsgathering.

A quick note: platforms vary. Twitter, Reddit and Google currently support Boolean searches, while YouTube supports them to some extent on top of its advanced search function (a Boolean search on YouTube might not work when sorting by ‘relevance’, but will when sorted by upload date). Facebook used to support Boolean searches, though it appears it no longer does.

How to write a basic search query

Boolean searches help you to specify exactly what you are looking or not looking for. For example, let’s say you’re searching for posts during a breaking news event, such as the Notre Dame fire. You want to search for Notre Dame, but you won’t want posts about the Disney film.

A boolean search will allow you to include posts that mention “Notre Dame”, but exclude ones about the Disney film to refine your search results and find the information you’re after.

This is possible with ‘operators’, which allow you to combine multiple keywords. There are three operators for basic searches: AND, OR, and NOT.

AND

AND allows you to narrow your search to only retrieve results that combine two or more terms. For example, you might want to search for “Notre Dame” and fire.

OR

OR allows you to broaden your search to retrieve results connecting two or more similar terms. This can be good for misspellings and typos.

In the case of Notre Dame, you could search for “Notre Dame” OR “Notre Dam”. This will retrieve all results containing either phrase.

NOT

NOT allows you to exclude terms you don’t want to appear in your search results. For example, you might want to exclude mentions of the Disney film The Hunchback of Notre Dame, and so you could write “Notre Dame” NOT “hunchback”.

Key points:

  • Operators (AND, OR, NOT) must be written in capitals, or they won’t work
  • If you’re searching for phrases (terms made up of multiple words) then you have to put them in quotation marks (eg “Notre Dame”)
  • You won’t be able to find information that has been made private by a user

How to add complexity to your search

Grouping sections together is most useful for long and complicated searches. It will reduce the risk of the search breaking and is simpler to manage. Also known as nesting, this approach also allows you to search for several variations of your search terms at once. To group parts of a search together, you simply use brackets or parentheses ( ).

For example, if you’re looking to find various spellings of Notre Dame, while also excluding posts about the Disney film, you would write:

(“Notre Dame” OR “Notre Dam”) NOT (“hunchback” OR “hunch back”)

These are the building blocks for undertaking more complex social monitoring projects. For example, First Draft’s Senior Research Reporter Alastair Reid was looking for accusations of media bias around the European Parliament elections.

He used this Boolean search string on Twitter: (#EP2019 OR #EuropeseVerkiezingen OR #EuropeanElection2019 OR #EUelections2019) AND (“mainstream media” OR msm OR media OR press OR lugenpresse OR “fake news” OR “fact check” OR elite OR metropolitan OR fakebook OR fascistbook OR banned OR censored OR “free speech” OR “politically correct” OR “PC brigade” OR “Western propaganda”)

The parts of your search that are inside parentheses will be prioritised by the database or search engine to retrieve a broader set of results.

How to search for posts from specific dates and locations

You don’t have to only search for words – Boolean can perform specific searches looking for dates, locations and hashtags.

Dates

Traditionally, to search for content within a certain timeframe, you can search using the “since:” and “until:” operators (on Google it’s “before:” and “after:”).

For example, if looking for examples of people turned away from a polling booth on the day of the European Parliament elections, you could search:

“polling booth” AND “turned away” near:London within:15mi since:2019-05-23 (year-month-day)

You can also look for content posted up to a certain date. For historic examples of people being turned away from polling booths, search:

“polling booth” AND “turned away” until:2019-05-22

Twitter, Google and YouTube also all provide dates in their advanced search functions which allow you to select a custom date frame.

Locations

To search for social posts within a geographic area to find a source, you can search for content that was published in a specific location.

While very few social media users geotag their posts, it’s possible to search for the specific locations of the ones that do.

For example, if there was a lack of booths at a London polling station, you might search: “polling booth” near:London within:15mi

You could even search: “polling booth” AND “turned away” near:London within:15mi

This guide appears as part of a week-long series on social media search queries. To stay informed, become a First Draft subscriber and follow us on Facebook and Twitter.