opto / Expression-Search-NG

update of Thunderbird addon ExpressionSearch/Gmail UI for TB 78 and later
61 stars 8 forks source link
                                                                      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Expression Search / GMailUI is an extension to Thunderbird (versions 31.0+) which adds powerful message searching features. Init by Ken Mixter, developed over many years by Opera Wang, updated to TB 78+ by Klaus Buecher/opto.

Type "hello world" to search within the current view for this string in subject/from/to/cc.
Type "from:fred to:tom attachment:yes" or "f:fred t:tom att:yes" to see all messages from Fred to Tom in the current view that have an attachment.
Type "s:bbb t:(oo -pp)" to see all messages with subject bbb, send to oo but not to pp. Press Ctrl+Enter to have this search apply to all folders through virtual folder.
Press Shift+Enter to invoke Gloda Search in all indexed folders.
Use Ctrl/Shift+Right Click to search the clicked subject/From/Recipient.

Expression Search's features are described below.

The transfer to TB 78 is underway. Some features may not work yet. You can report issues at the home page for TB78: expression-search-NG

It is gratefully appreciated if you can support the transfer to TB 78 by a donation.

Search expressions and quick search key

This extension adds a new search text box to the end of your quick search bar. Whatever phrase you enter is searched for in your currently selected folder's to/from/cc/subject fields. Notice that by default the body is not searched for your search phrase. If that results in too many matches,you can focus the search using "operators". Operators are just short words followed by a colon, such as "from:amazon.com".

Here are some examples:

  1. weekend plans

    This expression searches all messages in the current folder or view for 'weekend plans' in the from, to, cc, or subject fields.

    If "Act as normal filter" enabled, the "Sender", "Recipients", "Subject" and "Body" buttons will determine to search in which fields.

  2. from:mike or f:mike

    This expression searches all messages in the current folder or view for 'mike' in the from field.

  3. to:bill or t:bill

    This expression searches all messages in the current folder or view for 'bill' in the to or cc fields of the message.

  4. tonocc:bill or cc:tom or bcc:riddle

    Like above, tonocc will search to field only, cc/bcc will search cc/bcc field only. Case insensitive.

  5. only:tom or o:tom

    Search for 'tom', and 'tom' should be the only recipients in to filed. Case insensitive.
    Note: 'only:(tom or jerry)' will get message that to filed is 'tom' or 'jerry' only, while 'only:(tom and jerry)' will get nothing, please use 'only:(tom,jerry)' instead if you want to search emails that recipients contain and only contain both 'tom' and 'jerry'.

  6. fromto:tom or ft:tom

    Search for 'tom', and 'tom' can be in either from, to, cc, or bcc. Case insensitive.

  7. subject:electric bill or s:electric bill

    This expression searches all messages in the current folder or view for 'electric bill' in the subject fields of the message. Case insensitive.

  8. simple:this subject contains special characters like ( ) ' " - etc

    This expression searches all messages in the current folder or view in the subject fields of the message. And the pattern can contain special characters. unlike "subject" search, this search won't suffer from Bug 124641.

    This pattern must be the last pattern. Case sensitive.

  9. regex:/^begin/i or re:end$ or r:/\d+\s*\d+/

    This expression searches all messages in the current folder or view with Regular Expressions in the subject fields of the message.

    This pattern must be the last pattern. Case sensitive unless you have //i.

  10. headerre:List-Id=/all-test/i or h:list-id or h:sender=/^Bob/ or hr:header~/^value/

    This expression searches all messages in the current folder or view with Regular Expressions in the header of the message. The header should be already saved in Thunderbird's .msf database. You can config the headers in 'options/Search More Headers', If you added one header, it will only affect newly added emails unless you do 'repaire folder'.

    This pattern must be the last pattern. Header is case insensitive, Value is case sensitive unless you have //i. If the value is empty, Any message has the header will match.

  11. fromre:/^begin/i or fr:end$

    This expression searches all messages in the current folder or view with Regular Expressions in the from fields of the message.

    This pattern must be the last pattern. Case sensitive unless you have //i.

  12. tore:/^begin/i or tr:end$

    This expression searches all messages in the current folder or view with Regular Expressions in the recipients(to/cc/bcc) fields of the message.

    This pattern must be the last pattern. Case sensitive unless you have //i.

  13. attachment:yes or a:yes

    This expression searches all messages in the current folder or view for an attachment, Notice that it does not search for attachments named "yes". You can also use "y" or "1" for "yes". You can use "no", "n", or "0" to search for messages without attachments.

  14. filename:foo.doc or fi:image or fn:msword or file:html

    This expression searches all messages in the current folder or view for an attachment name or type. Case insensitive. If you just want to search messages that have attachment, use attachment:yes instead of using this one.

  15. is:replied or i:UnRead or status:Forwarded or status:F

    This expression searches all messages in the current folder or view for status, The status can be one of Replied, Read, Marked/Star, Forwarded, UnRead, New, ImapDeleted or Attachment.

  16. before:2011/03/09 07:12:00 or be:09 Mar 2011 05:00:00 or after:Mar 10, 2011 or af:(2011/03/01 -2011/03/09)

    This expression searches all messages in the current folder or view within the date range, The date format can be checked Here.

  17. before:07:12:00 or be:5:9 or after:03:07:05 or af:(3:0 -4:0)

    This expression searches all messages in the current folder or view within the time range. af:(3:0 -4:0) will search for messages in current view that date between 3am to 4am EVERY day.

  18. date:2011/01 or date:2011/01/03 or d:" 03:" or in zh-CN locale d:2011?3?

    This expression searches all messages in the current folder or view to match date. The internal format for compare is "yyyy/mm/dd hh:mm:ss", locale date is also supported.

  19. ag:3 or da:3 or age:3 or older_than:3 or days:(3 -5) or age:today or newer_than:8week

    This expression searches all messages in the current folder or view to match age in days. days:(3 -5) will search for messages that age between 3 to 5 days.

  20. size:10 or si:(0.5M -2M) or larger:1G or smaller:1024 or sm:10

    This expression searches all messages in the current folder or view to match size in KB or MB/GB. size:(3 -5) will search for messages that size is larger than 3KB and less than 5KB, that is 4.x KB.

  21. body:electric bill

    This expression searches all messages in the current folder or view for 'electric bill' in the body of the message. On large or remote folders it may take some time. Also, if you combine this with other search operators like "from:", "subject:" or "to:" this will speed things up considerably.

  22. bodyre:/hello.*world/i or br:test

    This expression searches the body of all messages in the current folder or view with Regular Expressions. Case sensitive and should be the last pattern. Only search offline messages.

  23. label:Important or tag:TODO or l:NA

    This expression searches all messages in the current folder or view which has the tag Important. l:NA means all messages without tag.

  24. all: weekend plans

    This expression searches all messages in the current folder or view for 'weekend plans' anywhere in the message, including the from, to, cc, or subject fields, and the body.

  25. g: weather

    This will call gloda (faceted) search if gloda enabled. This mode can't be used together will other specifications like 'f:' or 't:'.

  26. 3+2

    If the expression looks like an arithmetic one, when you press enter, it will be calculated and the result will be shown in the search box.

  27. from:-foo from:-bar [...]

    So-called Inverted Search. This is a not x and not y [...] search for the selected attribute (Here: from:).
    This is the GMail search-equivalent of: -foo -bar.

Hot Key

By default, Press Ctrl+Shift+K, your cursor will appear in the expression search bar and you will be able to type.

Expression Search add one additional hot key "Ctrl+B".

Once you are typing in your search query, and you hit enter or otherwise let it begin searching, your cursor will remain inside of the query box to allow you to modify the query. However, if you'd rather go back to browsing your messages, instead of clicking on the message headers in your search results, you can just press 'ESC' to to clear the search criteria, and press 'ESC' again to refocus back

Quick Search Virtual Folder

If you haven't before used 'virtual folders' in Thunderbird, let me introduce them. This standard feature of Thunderbird lets you create a search, name it, and then have that name appear in your folders list. You can select that folder from the list and see the current result of the saved search. Note two useful things: 1) the 'contents' of the virtual folder can actually be in any of your real folders, and so a virtual folder actually can 'contain' messages that span many folders, and 2) the virtual folder's contents are recomputed each time you view it, so if you saved a virtual folder with 'sender' field containing 'Donald', then if you receive a new message from someone named Donald, it will be placed in your INBOX, but you'll immediately be able to switch to your Donald virtual folder, and find it there.

So that's what regular virtual search folders do in Thunderbird. But this extension makes it extremely easy to create them. Now, when you normally hit 'enter' in the Expression search quick search bar, you can instead hit 'ctrl-enter' and a virtual folder called 'ExressionSearch' will be created (or modified if it already existed) to search for that search across ALL of your folders in the current account.

The resulting virtual folder 'ExpressionSearch' can then be modified by editing properties, or can be renamed to make it a permanent virtual search folder. If you do not rename the folder, the next time you use ctrl-enter the ExpressionSearch virtual folder is reused to show your new quick search result.

The option "Keep selected folders for saved search" to have the "ExpressionSearch" virtual folder being persistent not only allows you to mark it as "Preferred" without the setting being lost when restarting TB, but also you can edit the properties of the "ExpressionSearch" virtual folder to specify once for all which of your physical folders should be searched or not with a global non-faceted search (CTRL+Enter).

Where "ExpressionSearch" is created can also be set in the option dialog, By default, it's the root folder of the current disaplyed folder

You can back to original folder by press Ctrl+Alt+LEFT

More complex searching

The quick search bar allows you use the simple expressions from above, but it also allows you to compose more complex searches. For instance, if you want to search for a message from Bob Barker to Dave Letterman about monologues, you can use:

f:Bob Barker t:Dave Letterman s:monologues

If you are tired of getting results that have jokes about "Monica", you can instead use:

f:Bob Barker t:Dave Letterman s:monologues -Monica

If you are interested in messages from either of these celebrities:

f:Bob Barker or f:Dave Letterman

Notes

Note 1: For the average user, the above information is usually adequate. If you are curious, this feature still relies upon an underlying Thunderbird message searching mechanism. That mechanism cannot always perform searches correctly that have a combination of boolean operators. So, if you try to perform a search that mixes "ands" and "ors" you may get back too many results. As an example, if you were to search for "t:dan and f:(bob or dave)" you will be mixing boolean operators and the results may be over inclusive or may work. As an extra technical note, if you did "t:dan and -f:(bob or dave)", DeMorgan's theorem takes place and you are actually composing a search of "t:dan and f:-bob and f:-dave".

However, due to restrictions in Thunderbird's virtual search folder, the complex searching results maybe correct in your current search results, but maybe NOT in you search folder. as the search folder can only handle 'Match all' and 'Match any' types.

Note 2: If you want search all folders using expression, you can create a virtual folder manually (Ctrl+Shift+F) with 'Match all messages', then using expression search in the virtual folder.

Note 3: In case you also using the normal search filter, the final results is logically "AND", that means both filter are effective.

Click 2 Search

If Enabled, you can use Ctrl/Shift+Right Click on sender/recipient/subject column to search for the same sender, recipient or subject.

For subject line, if provided regular expression match/replace patterns and enabled the replace for corresponding key combo, the pattern will be first executed

Replace subject before search.
Multiple matches are ORed. Example:
    Match:   \[#(\d*)\]
    Replace: $1
    Subject: [#1212][#2323]Some text
    Result:  (1212 or 2323)

Also common prefix like 'Re:', 'Fw:', [mail-list-name] will be removed before search.

Version history

Known Issues of this extension or Thunderbird

Compared with original GMailUI 0.6, these features are still missing:

If you do need to change the hotkeys, please try other extensions below.

Other Extensions

You can try the following extensions to make your Thunderbird more convenient.

Thanks

Feedback, Suggestions, and on-going Development

Klaus Buecher/Opto's Home Page for TB 78+: expression-search-NG

Opera Wang's Home Page (TB 60): expression-search, not in active development

Ken Mixters Home Page: GMailUI, pre 2005