Using Boolean Searches to Follow Iran Election and More on Twitter

Iran’s June 12 presidential election between incumbent Mahmoud Ahmadinejad and challenger Mir Hossein Mousavi reportedly resulted in a landslide victory for Ahmadinejad. This outcome sparked riots across Iran, accusations of voting fraud and protests in several nations. (It also sparked a “Saturday Night Live” spoof music video.)

When reporting on this unfolding story and the possible irregularities in Iran’s election, Twitter can be a useful tool for getting real-time context about what’s happening and what people are thinking and saying.

As I’ve written before, hashtags (short alphanumeric “labels” prefaced by “#”) are a key tool for following any topic, breaking or otherwise, on Twitter.

The leading hashtag to follow appears to be #IranElection. But far more people are talking about this issue than reliably using the hashtag, so it’s also useful to search Twitter for these keywords: Ahmadinejad, Mousavi, (or Moussavi), Iran, and Tehran. (Hashtags and keywords are not case-sensitive.)

That’s one hashtag plus at least four keywords (more if you consider alternate spellings). Quite a bit to keep your eye on. Plus if you use a column-based Twitter tool such as Tweetdeck, Seesmic Desktop or Monitter, you only have a limited number of columns to work with. (Each column displays the results of only one search query.)

Fortunately, when you’re trying to monitor multiple hashtags and keywords around a particular topic, you can save space in your display tool by doing a more sophisticated search query.

Try creating an “OR query” — a type of boolean query structure that allows you to ask about more than one search term at a time. For instance, if you wanted to monitor everything above in one column, your query could look like this:

#iranelection OR Ahmadinejad OR Mousavi OR Iran OR Tehran

Here are the results of that OR query. Yes, gathering tweets from so many search terms on such an active topic predictably yields a fire hose. But a fire hose can be a useful starting point, since it allows you to more easily spot when new angles, players or other developments arise.

If you’d like, you can grab the RSS feed from that firehose and run it through Yahoo Pipes for sophisticated filtering or mashups. You also can use boolean search logic to narrow your focus on a specific angle using the “AND query.”

For instance, one angle of the Iranian election that intrigued me was that the Iranian government had shut down SMS text messaging, which could hinder people’s efforts to vote, monitor the election process, report information and action (including via Twitter), organize or attend protests, avoid areas of protest or violence or otherwise communicate or coordinate directly.

To follow this angle on Twitter, I’m monitoring tweets that include both the hashtag #iranelection and the keyword SMS.

In Twitter’s own search engine, this kind of query may seem a little confusing because Twitter search assumes that “AND” is implied. To find tweets that include both #iranelection and SMS, my query would be #iranelection SMS — with no “AND” operator explicitly included. That’s because Twitter search assumes when you enter more than one search term, you mean “and,” so you only want results that include all of those terms (not any of them).

If I were to include “AND” in my Twitter search query, it would only return tweets that include the word “and” — far fewer and much less current results. Not every search engine behaves this way, so run some tests for the search tools you use to make sure you’re structuring queries to get the results you want.

Knowing how to structure boolean search queries can make it easier to monitor Twitter when you have a limited number of display columns and when each column can only run one query or filter. Also, if you’re using Twitter search directly through the Web (rather than a Twitter application), there are additional Twitter search operators and advanced search features.

I can’t claim credit for this boolean-search-to-save-space trick. Though I’ve long known of boolean searches, it was Dow Jones librarian Daniela Barbosa who reminded me yesterday of their Twitter search application for major current events, conferences and more. 

Barbosa is participating in this week’s Semantic Technology Conference in San Jose, Calif. You can follow this fascinating conference via several Twitter hashtags, which (at Barbosa’s nudging) I’m monitoring via this boolean query in Tweetdeck: #semtech2009 OR #semtech09 OR #semtech.

So, in just three of my 10 available columns in Tweetdeck, I’m monitoring the Semantic Technology Conference, the firehose of Iran Election tweets and the Iranian SMS shutdown. In other columns, I’m keeping an eye on all of my Twitter friends; “@replies” and direct (private) to me; my favorite hashtag of the moment, #justsayin; a special subgroup within my friends; and what’s happening in Oakland, Calif. and Boulder, Colo.

That may sound like a lot, but actually it’s a very manageable radar screen. Even better: it’s my real-time serendipity engine.

For more advice on tracking the Iran election via Twitter and other social media, check out this handy, practical guide that Mashable published Sunday.

We have made it easy to comment on posts, however we require civility and encourage full names to that end (first initial, last name is OK). Please read our guidelines here before commenting.