The command opens a non-modal dialog window that allows the user to specify search criteria, as shown below:

Query form
The user should fill in one or several fields with values against which the database contents will be tested. When OK is pressed, the program generates a query based on the non-empty fields (they're combined with a logical AND, therefore for a particular message to be retrieved, it has to match all the submitted criteria). Then it runs the query and on completion, create a new page of results in the window from which the command has been called.
An email address is expected. You may type only a part of the address and hit the space bar to autocomplete: a list of addresses containing the substring typed will then be fetched and shown in the combobox. Any means that the messages to retrieve must have that address either in a From, To, or Cc field.
The date format expected is YYYY/MM/DD (US style) or DD/MM/YYYY (european style) depending on the current preferences. One of the minimum (lower bound) or maximum (upper bound) can be omitted to select an semi-open interval of dates.
Use this field to retrieve only the more recent messages, with "recent" expressed as a number of days, or weeks, or months back from now.
an email address is expected, and autocompletion is available by hitting the space bar, as for the From/To/Cc/Any input field.
a substring that the message subject must contain. The search will be case insensitive.
a substring that the message body must contain. Be aware that the search is case sensitive.
This field should be used by users who know SQL and the Manitou-Mail database schema. The input has to be a sql statement that returns a list of mail_id. Example:
SELECT mail_id FROM attachments WHERE content_type like 'image/jpeg' and content_size>1024*1024
(that query will retrieve any message to which a big jpeg image has been attached). As with any other field of the query dialog, the result of that query will be ANDed with the other criteria.
The combobox lists all available tags. Selecting a tag will constrain the messages retrieved to those to which that tag is assigned. The hierarchy of tags is flattened so that child tags are expressed as parent_tag->child_tag
Pressing the "More..." button will display a panel of all possible status combinations, with "Yes","No" and "Either" choices for each one. The status is a set of boolean properties (properties that can be true or false)
"Either" means no test will be performed on the corresponding property.
"Yes" means the corresponding property has to be true.
"No" means the corresponding property has to be false.
For example, choosing "No" for "Replied", and "No" for "Forwarded", and "Yes" to "Processed", means you want to constrain the messages to retrieve to those that have been marked as processed, but for which no reply has been issued, and that haven't been forwarded as well.
An integral number is expected in this field. It will limit the number of messages fetched from the database to this value, even if there are more messages that match the criteria entered.
It is intended to avoid cluttering the network and/or your computer if the query hasn't been narrowed enough to retrieve a reasonable number of messages. Several thousands of messages to fetch in one go is still reasonable, but millions of messages is not (it actually depends on the throughput of the link with the database and the power of the computer running manitou-mail user's interface, though).
Sometimes a search has to be modified several times before giving satisfactory results. After results are shown, the query command may be used to reopen the query selection dialog, with the criteria already set and ready to be modified.
Queries retrieve messages that match criteria at the time they're run. Since new messages come into the database independently of the user interface, it is possible to explicitly run again the query and have those new messages added to the current list. This is done with the command or the F5 key. Note that messages in the current list that no longer match the query are not removed from the list.
Built-in selections "New->All" and "Current->All" can also be automatically and periodically refreshed based on the setting on a Preferences parameter (Check new mail every X minutes). When this parameter is set and new messages are available, an icon with a number of messages gets displayed in a button at the bottom right in the status bar and a message "New mail is availaible" is left at the bottom left.
Clicking on the button will add the new messages to the current list (actually a refresh command will be issued, which should have the same effect except if you're in a multi-user environment and another user has already changed the messages so that they no longer match the "new" or "current" criteria).