Searching mail

This page describes what the search box in the web interface does. Press / or Ctrl-K (Cmd-K on a Mac) to reach it from any page.

The short version

  • Every word you type must match. report domain finds messages that contain both words, in any order.
  • Put - in front of a word to leave out messages that contain it: report -domain.
  • Put a field name in front to look in one place only: subject:invoice.
  • Quotes group words, they do not mean an exact phrase.

Every word must match

A search for report domain finds a message only if both report and domain appear in it. A leading + changes nothing, because every word is required already: +report is the same search as report.

Very common words such as “of” and “the” are skipped rather than required, so report of the domain finds the same messages as report domain.

There is no OR. To find messages that match either of two words, run two searches.

Results are sorted by relevance.

Quotes group words, they are not an exact phrase

"report domain" finds a message that contains both words. They may be in any order and anywhere in the text, so a body that reads domain ... report matches too. Bongo does not keep word positions in its search index, so an exact phrase cannot be searched for.

Quotes are still useful after a field name. subject:"Report Domain" requires both words to be in the subject, whereas subject:report domain requires report in the subject and domain anywhere.

Leaving words out

report -domain finds messages that contain report and do not contain domain. A quoted group with a minus, such as -"report domain", leaves out every message that holds both words, in any order.

A search made only of exclusions, such as -domain, returns every message that does not contain that word.

Fields

Prefix Searches Matching
subject: the subject words, not case-sensitive
body: the message text words, not case-sensitive
from: the sender the whole value, exactly, case-sensitive
to: the recipients the whole value, exactly, case-sensitive
tags: the tags on the message the whole tag name, case-sensitive

subject:report finds a message with report in the subject only, and body:report one with it in the text only. tags:work finds messages tagged work; tags:wor finds none.

from: and to: are not word searches. The value must equal the whole stored value, and the sender is stored as the From header shows it, display name included. For a message from Alice <alice@example.com> you need from:"Alice <alice@example.com>", with quotes because of the spaces. from:alice@example.com finds only messages whose From header is the bare address. This will change in v0.20, so that an address alone is enough.

Words with no prefix search the subject, the text and the tag names of the message, so work also finds a message tagged work.

Text that cannot be parsed

Some text is not valid search syntax: a trailing colon (subject:), an unbalanced quote ("report domain), or a stray symbol (a > b). Rather than fail, Bongo searches once more, treating the text as plain words.

For that second search each of these characters is replaced by a space, and every remaining word is required:

: + - " ( ) ^ ~ * ? \ { } [ ] / > < = ! & |

Two things follow:

  • A -word no longer leaves anything out, because the - becomes a space and the word becomes required. report -domain: finds messages with both report and domain.
  • A search with nothing left, such as * or only punctuation, shows an empty page.

If a search still cannot be run, the page says “Search could not be run”.

What is searched

  • Your own folders, including Junk and Trash. A message that is in several folders is shown once.
  • Not shared folders.
  • Mail only. Contacts and calendar events never appear in the results.
  • At most 200 results are kept, shown 25 to a page.

Searching from a mail client (IMAP)

An IMAP SEARCH TEXT is not search syntax, and none of the characters above mean anything in it. The argument is read as plain text: all of its words must appear in the subject, or all of them in the body, or the whole argument must equal the stored From or To value. An empty argument matches every message. An argument with no searchable words, such as only punctuation or only “the”, matches nothing in the subject or body.

View this page's source on GitHub