An unofficial blog that watches Google's attempts to move your operating system online since 2005. Not affiliated with Google.

Send your tips to

March 7, 2008

Simpler Gmail Queries

There's an easy way to use logical disjunction in a Gmail query. Instead of typing OR after each term, you can just use curly brackets and separate the terms with spaces. Here's the official way:

dan OR "brian clouse" OR teja

and here's a simpler way to write the same query:

{dan "brian clouse" teja}

Note that you need to use quotes for multiple words and you can combine the expression with other Gmail operators. To find all the messages sent by Dan, Brian Clouse or Teja, search for:

from:{dan "brian clouse" teja}

To find the messages that have one of the following labels: unread, starred and work (the first two labels are built in), use:

label:{unread starred work} (or: l:{unread starred work})

By default, Gmail uses the logical conjunction between your terms, so if you search for:

dan "brian clouse" teja

Gmail will display all the messages that contain Dan, "Brian Clouse" and Teja. To group these terms, use parenthesis:

from:(dan "brian clouse" teja)

Some useful queries:
label:(unread inbox) - the unread messages from your inbox
label:(starred chats) - your favorite Google Talk conversations
label:(unread muted) - the conversations you've muted that have unread messages
filename:{pdf doc xls ppt} - messages that have attached a PDF file or a Microsoft Office document
label:unread subject:{important urgent} - unread messages that include "important" or "urgent" in the subject.

{ credit for the magical-curly-brackets tip: Paul Buchheit }


  1. Biggest problem I have with Gmail's message search is that it only searches for words, not strings.

    I searched in vain yesterday for an old e-mail message (using here a made up example):

    Searching for "John" got me no meaningful hits. Searching for "Doe", nothing.

    The message I wanted was from "" and there was no spelled-out version of his name in the message.

    Almost everyone expects that a search for "john" will get a hit on "johndoe" but in Gmail it doesn't.

    The fact that you can't sort your mail by date or any other factor make this search restriction maddening.

    I suspect this is because Gmail stores the messages with every single word indexed, and so those sort searches are very fast. That's a good thing. But for the tough cases, we really need some sort of brute force string search, maybe activated by a checkbox so as not to slow everything else down.

  2. I don't know if switching to partial matches is a good idea. Yahoo Mail's search is like that and it returns a lot irrelevant results. Maybe Gmail could support regular expressions (or at least wildcards).

  3. Interesting, thanks. And do you know how to find emails that have no label ?

  4. Go to the advanced search and there is a drop-down that includes all your labels as well as "all". There is also an equivalent tag you can use in your search string, but I never can remember it so I use the above approach. I sort of thought all was the default, but the word-search restriction often fools me into thinking I've deleted the message somehow when in fact it was out there all along.

    It just seems natural to think that the Gmail search would be as forgiving (as in suggesting possibly misspelled words etc.) as the normal Google search is, but in fact they seem to be two totally independent things.

    If I were in charge of Google technology there would be a fundamental rule: No two facilities in Google will operate differently (to the point of using the exact same code from a library etc.) without a very good non-technical, i.e. usability reason. They violate my mythical rule constantly for example in the differences between Google Aps IDs and normal Google IDs.

    Eventually it moves from user confusion, to bloat, to bugs (after the developers themselves can no longer keep it straight).

  5. This is what I hate about gmail, and about so many Google products (all based on the philosophy that SEARCH > SORT).

    Jeez, how about giving us some choices, instead of everyone having to come up with all sorts of workarounds and plugins?

    Sometimes SORT is faster than search. Sometimes I don't know what I'm searching for. It's easier to see a list.

    I feel like I'm trapped between the Microsoft world of software where extremely useful features are buried 5 layers under useless propietary crap, and the Google (and Mac) world where all the choices are made for you ahead of time -- and they are good choices, unless you want to do something else.

  6. Does the {} work for filters? I find it infuriating that in order to create a list of people that I want a particular filter to apply to I have to put "OR" between each one.

    I usually compose a message to all the people, then copy the To: field into the filter, then spend about 15 mins going through it to conform to google's stupid regulation on filters.

  7. The very limited search facility of gmail is a shame on google. It is maddening. How could google build something like gmail and then let it sit there with some of its most important features half working? So much my info is in gmail and I can't access it properly!

  8. I agree with the complaints about sorting 9or lack thereof). How difficult could it be to add this capability given the resources of Google??

  9. I'm still looking for the answer to a question Antonio posted, "And do you know how to find emails that have no label." I try to put labels on all of my my mail, but if I miss one how do I find it? Is there a way to search label:none (fyi, I tried that, and it doesn't work). Also I want to bring up my confusion between the difference in a built in label and one you create. When you search for the "label" inbox, it uses in:inbox. With a custom label, it's label:mylabel. Is there really a difference? Confusing.

  10. Well,there is a roundabout way to find gmails with no label.
    That is search for -label: {inbox outbox jokes label4 label4 label5 ... you-get-the-picture} :-(

    But then when you do this, gmail forgets to show your preference for showing number of emails per page. It shows only 20. :-(

  11. why the hell doesn't gmail have a sort by sender like outlook?

    WHY doesn't gmail let users sort by sender???

    there has to be a reason. it is SO annoying!!!!

  12. how to import any mails from one id to other id ? is it possible? bcoz my maid id inbox is full and other mail will be bounce now ... can u help me urgent?


Note: Only a member of this blog may post a comment.