Enable Boolean expressions in Filter UI (nested/grouped/mixed/combined/complex filters having AND and OR conditions)
Categories
(MailNews Core :: Filters, enhancement)
Tracking
(Not tracked)
People
(Reporter: hyc, Unassigned)
References
()
Details
(Keywords: papercut, uiwanted, Whiteboard: [filter-mgmt][gs])
Attachments
(5 files)
Reporter | ||
Comment 1•19 years ago
|
||
Comment 2•19 years ago
|
||
Comment 3•19 years ago
|
||
Comment 4•19 years ago
|
||
Assignee | ||
Updated•16 years ago
|
Comment 10•15 years ago
|
||
Comment 11•15 years ago
|
||
Comment 12•13 years ago
|
||
Comment 13•13 years ago
|
||
Reporter | ||
Comment 14•13 years ago
|
||
Comment 15•13 years ago
|
||
Comment 16•13 years ago
|
||
Comment 17•13 years ago
|
||
Comment 21•12 years ago
|
||
Comment 22•12 years ago
|
||
Comment 23•12 years ago
|
||
Comment 24•12 years ago
|
||
Comment 25•12 years ago
|
||
Comment 26•12 years ago
|
||
Updated•11 years ago
|
Comment 29•11 years ago
|
||
Comment 30•11 years ago
|
||
Updated•11 years ago
|
Comment 33•10 years ago
|
||
Comment 35•10 years ago
|
||
Comment 38•9 years ago
|
||
Comment 39•9 years ago
|
||
Comment 40•9 years ago
|
||
Comment 41•9 years ago
|
||
Comment 42•9 years ago
|
||
Comment 43•9 years ago
|
||
Comment 45•8 years ago
|
||
Comment 48•6 years ago
|
||
Reporter | ||
Comment 49•6 years ago
|
||
Comment 50•6 years ago
|
||
Comment 51•5 years ago
|
||
I like to suggest to apply this issue compatible to Sieve: https://en.wikipedia.org/wiki/Sieve_(mail_filtering_language)#Use
Comment 52•5 years ago
|
||
See also bug 79525
Comment 54•4 years ago
|
||
Is the current functionality enough to resolve cases like bug 1465076 ?
Reporter | ||
Comment 55•4 years ago
|
||
(In reply to travneff from comment #54)
Is the current functionality enough to resolve cases like bug 1465076 ?
Yes. All the required functionality in the filter engine is present. The only thing lacking is the UI.
Comment 56•4 years ago
|
||
(In reply to Howard Chu from comment #55)
Yes. All the required functionality in the filter engine is present. The only thing lacking is the UI.
I'm missing some point. Can I build such a filter with single rule in existing UI?
I mean, seems like everything is present there: I set "sender" -> "contains" -> "addr1@example.com OR addr2@example.com"
Tried to play with various separators with no success.
Do I just missing the right syntax? Or it shall not work this way at all?
Reporter | ||
Comment 57•4 years ago
|
||
(In reply to travneff from comment #56)
(In reply to Howard Chu from comment #55)
Yes. All the required functionality in the filter engine is present. The only thing lacking is the UI.
Do I just missing the right syntax? Or it shall not work this way at all?
No. Nothing in the current UI will do what you want. That's the entire point of this bug report.
Comment 58•4 years ago
|
||
I still think nesting filters (adding filter condition "filter X applies" and allowing "no action" as an action for "sub-conditions") would be the cheapest and most intuitive way of supporting this functionality. And it wouldn't really require any new UI to be built.
Comment 59•4 years ago
|
||
Sigh... this UI bug has been around for 8 years, and we still don't have any functionality. While waiting for perfection, none of the users have access to the elegant filter logic that's in the underlying filter engine. Axel Grude's suggestions look promising. Can we get something usable? This year?
Comment 60•4 years ago
|
||
I like to suggest to apply this issue compatible to Sieve: https://en.wikipedia.org/wiki/Sieve_(mail_filtering_language)#Use
See also bug 79525
Comment 61•4 years ago
|
||
(In reply to Ulf Zibis from comment #60)
I like to suggest to apply this issue compatible to Sieve: https://en.wikipedia.org/wiki/Sieve_(mail_filtering_language)#Use
See also bug 79525
If there is a public parser for Sieve that might be a nice addition for FiltaQuilla too... if you can find a developer who wants to devote time to this.
Comment 62•3 years ago
|
||
Hi Alex, FYI - 19 duplicates. We have the backend, but missing the UI.
This would be a high-value addition to the filter ecosystem.
Perhaps we could at least try something like bug 1465076 so that users don't have to add 100 filter rows just for filtering "sender contains (s1 or s2 or s3 .... or s100).
Comment 63•3 years ago
|
||
Could we put this at least on the Thunderbird roadmap for filters?
I know it has been 17(!) years, but this enhancement here (bug 297852) is the single most useful addition to the filter eco-system apart from what the addons filtaQuilla and quickfilters can provide.
Current bugs on the roadmap (https://thunderbird.topicbox.com/groups/planning/Tf4da52fcc100a6d2):
- Rewrite of Filtering into javascript (bug 1574136).
- Support to filesystem actions (bug 1664171)
Other notable additions to the roadmap would be:
- the adoption of a new transfer protocol that goes beyond what pop3 and imap can provide as those determine many or at least some of the filter bugs (e.g. https://bugzilla.mozilla.org/show_bug.cgi?id=770137#c18, https://bugzilla.mozilla.org/show_bug.cgi?id=1215933#c58). Examples for other protocols (that i know of) would be sieve or the newer jmap, but i don't know if those are any good.
- I assume getting rid of existing bugs is not something one would want to write into a roadmap, although i would understand! xD
- Global message filter option to use a filter shared across accounts (bug 34973)
- ...
The good thing about Bug 297852
- Solutions exist. See comments above.
- The goal and the proposed means are not really controversial. Unlike some other long term enhancements, there seems to exist consensus that boolean expressions would indeed be very useful and something intrinsically good. At least nobody has voiced anything against the goal in itself yet.
As of now more fine grained filters are basically impossible to design, because a combination of bug 770137, bug 1320676 and Bug 1215933. These three bugs combined (+ the limitation to be able to apply filters only to the "income" folder) basically prevent most of the more elaborate fine tuned kind of filtering you might think about coming up with the current user interface.
There has rarely anybody really been adding/editing the filter code.
At least that is the impression i got by reading through all these bugs related to filters. Maybe putting this enhancement on the roadmap could give it some prominence and attract helpers/developers?
Solved bugs/enhancements related to filters in
2021: 6
2020: 8
2019: 8
2018: 3
2017: 4
2016: 4
2015: 4
2014: 3
2013: 1
2012: 2
Total open Bugs/enhancements to fix in 2021: 188
(and this number does NOT include stuff posted in mail news core)
Comment 65•3 years ago
|
||
(In reply to rwstahlhut from comment #33)
For UI ideas, take a look at how OS X implements more complex boolean logic
in the Finder window search (used for searches or to save search
strategies). The appearance is just like TB filters, but when you
option-click the PLUS for another step, you get an indented sub-step that
itself is just a recursive version of the level above.
Here you go. The search is: Name starts with A or B and ends with X or Y. This is the standard "grouping" with is supported by the TB backend already. Comment #11 points to bug 513277 where this test was added that shows the function:
https://searchfox.org/comm-central/rev/4dedf3bcc53db8db86356fbaa9deb9f6a5845a45/mailnews/search/test/unit/test_searchBoolean.js#151
Using "option +" on Mac to get another group is not so intuitive, that's why the same effect is achieved with a "Group" button in BMO's advanced search:
https://bugzilla.mozilla.org/query.cgi?format=advanced - Scroll down to "Custom Search".
As can be seen in the referenced test and the related IDL, grouping is already implemented in the backend:
https://searchfox.org/comm-central/rev/4dedf3bcc53db8db86356fbaa9deb9f6a5845a45/mailnews/search/public/nsIMsgSearchTerm.idl#33-34
Apart from unknown backend bugs yet to be discovered, implementing this comes don't to putting a frontend onto the existing backend. The UI option is also pretty clear since Mac Finder search, BMO custom search and the grouping in the TB backend are essentially all the same.
Comment 66•3 years ago
|
||
I got another 5 FiltaQuilla / quickFilters users requesting this feature within the last 2 months. It is still highly desired. Is there a possibility that somebody from Core could look at this as it is probably the single most useful improvement that would be possible in the filter area. even if we just added some checkboxes for the three flags (beginsGrouping, endsGrouping, !booleanAnd). The checkbox could do the inverse of what the global (or last outer) any / all flag does.
The UI could also hide these controls by default and we could have a flag or advanced setting to reveal this UI so that we won't get a support nightmare...
Comment 67•3 years ago
|
||
Analogue to the Mac search (comment #65), we're implementing this now, at time of writing, still WIP:
https://github.com/Betterbird/thunderbird-patches/blob/main/102/bugs/297852-grouping-search-term.patch
Comment 68•3 years ago
|
||
Turns out that those who said that the backend supported complex expressions were wrong. At least they are not serialised out or parsed back in, for example to msgFilterRules.dat and elsewhere ☹️:
https://searchfox.org/comm-central/rev/391d7cce6c4d581892af7d2a3f5c30a107d4a572/mailnews/base/src/VirtualFolderWrapper.jsm#183-197
https://searchfox.org/comm-central/rev/391d7cce6c4d581892af7d2a3f5c30a107d4a572/mailnews/base/src/nsMsgUtils.cpp#1596-1622
https://searchfox.org/comm-central/rev/391d7cce6c4d581892af7d2a3f5c30a107d4a572/mailnews/search/src/nsMsgFilterList.cpp#734
Plus there is no documentation how nsIMsgSearchTerm is meant to be used to create complex expressions apart from this example:
https://searchfox.org/comm-central/rev/391d7cce6c4d581892af7d2a3f5c30a107d4a572/mailnews/search/test/unit/test_searchBoolean.js#184
Apparently nsIMsgSearchTerm is used to flatten an expression tree into a list while moving the operators (nodes) into the leaves. This is the entire "documentation" we could find:
https://searchfox.org/comm-central/rev/391d7cce6c4d581892af7d2a3f5c30a107d4a572/mailnews/search/src/nsMsgLocalSearch.cpp#343-345
Summary for the backend: While complex terms with groups can be turned back into an expression tree (ConstructExpressionTree), there is no support for serialising/parsing those complex terms.
Reporter | ||
Comment 69•3 years ago
|
||
(In reply to Rachel Martin from comment #68)
Turns out that those who said that the backend supported complex expressions were wrong. At least they are not serialised out or parsed back in, for example to msgFilterRules.dat and elsewhere ☹️:
As stated in the initial bug description:
https://bugzilla.mozilla.org/show_bug.cgi?id=297852#c0
- the current Filter expression language (i.e., what gets saved in
msgFilterRules.dat) is ill-suited to actually representing complex filters.
I still believe adopting LDAP filter syntax would be the best way forward, but I never worked out what the migration would look like.
Comment 70•3 years ago
|
||
- the current Filter expression language (i.e., what gets saved in
msgFilterRules.dat) is ill-suited to actually representing complex filters.I still believe adopting LDAP filter syntax would be the best way forward, but I never worked out what the migration would look like.
That whole msgFilterRules.dat format is indeed very restrictive. I have a backup / restore functionality and it's hard to merge filters back when restoring, as there is no UID, last edited date or anything else but the filter name to deduct filter identity. I would love additional attributes that could be added by the JavaScript layer (and later through a mx API). I created my own JSON based format in quickFilters for the backup / restore functionality, which is a lot easier to read / edit and extend.
Comment 71•3 years ago
|
||
(In reply to Howard Chu from comment #69)
I still believe adopting LDAP filter syntax would be the best way forward, but I never worked out what the migration would look like.
Maybe it's not a good idea to attempt too much at once. We're now storing the beginsGrouping/endsGrouping as [ ] instead of ( ) in the file. The link in comment #67 now has the patch of the fully working solution.
Comment 72•3 years ago
|
||
Port of https://github.com/Betterbird/thunderbird-patches/issues/35
This also does a general overhaul of searchTerm.js:
- Removal of hideMatchAllItem() and updateRemoveRowButton()
- Removal of over-engineered global gTotalSearchTerms, badly tracking the length of the search term array
- Removal of gLoading, as a consequence of the gTotalSearchTerms removal
- Removal of gSearchRemovedTerms, we saw no use in tracking removed searchterms
- Moved badly conceived treecols for flex values out of the richlistbox, so the child count matches the richlist items
- Fixed clumsiness in removeSearchRow(): Just remove the row at the given index instead of searching for in the DOM
- Adding an empty search term for new rules, user might want to start off with a group instead
- Mitigation of https://bugzilla.mozilla.org/show_bug.cgi?id=1765077 (missing highlight, focus).
Further clean-up: Removed nsIMsgFilter.AddTerm() and renamed nsIMsgFilter.GetTerm().
Updated•3 years ago
|
Comment 73•2 years ago
|
||
(In reply to Rachel Martin from comment #67)
Created attachment 9272624 [details]
complex filters.pngAnalogue to the Mac search (comment #65), we're implementing this now, at time of writing, still WIP:
https://github.com/Betterbird/thunderbird-patches/blob/main/102/bugs/297852-grouping-search-term.patch
This looks so much better.
I came to request the same exact feature.
Because if for example I wanted to create this filter rule:
( (from,is,abc@mailcom) OR (from,is,xyz@mailcom) ) AND ( (subject,contains,A) OR (subject,contains,B) )
I need to create four rules in the current version, as:
(from,is,abc@mailcom) AND (subject,contains,A)
(from,is,abc@mailcom) AND (subject,contains,B)
(from,is,xyz@mailcom) AND (subject,contains,A)
(from,is,xyz@mailcom) AND (subject,contains,B)
I have more than 300 filter rules, just because the thunderbird doesn't support the complex filter rules yet.
Please make thunderbird supports it, even if we have to manually edit the "msgFilterRules.dat" file
Thanks
Comment 74•2 years ago
|
||
(In reply to DeaDSouL from comment #73)
Please make thunderbird supports it, even if we have to manually edit the "msgFilterRules.dat" file
See also: Bug 944944 Bug 294632 Bug 1756327 Bug 1755819 Bug 1763718
Comment 75•2 years ago
|
||
Just for the record, we're constantly making updates to our solution at https://github.com/Betterbird/thunderbird-patches/blob/main/102/bugs/297852-grouping-search-term.patch. The latest version doesn't apply cleanly to C-C any more due to dependencies with bug 683809.
Updated•2 years ago
|
Comment 77•2 years ago
|
||
I like to suggest to apply this issue compatible to Sieve: https://en.wikipedia.org/wiki/Sieve_(mail_filtering_language)#Use
So please add bug 79525 to the "see also" list (unfortunately I'm not granted to do that).
Comment 78•2 years ago
•
|
||
I have been using Betterbird for roughly half a year now with the new complex filters UI and it works very well.
The development process and code changes can be traced by having a look at following bugs:
- https://github.com/Betterbird/thunderbird-patches/issues/35 (fixed)
- https://github.com/Betterbird/thunderbird-patches/issues/60 (fixed)
- https://github.com/Betterbird/thunderbird-patches/issues/62 (fixed)
- https://github.com/Betterbird/thunderbird-patches/issues/63 (not fixed, but users are notified, if situation is triggered; rare edge case)
Positive observations:
- I personally have have filter rules that tag, move and copy messages from inbox to sub-folders and local folders and it just works.
- I was able to reduce the amount of filters I have substantially. Instead I now have more rules within a single filter
- I was able to conveniently use complex filters e.g.: [If Tag is X AND (message body contains M OR N OR O OR P OR Q)], then do Z.
- I was able to work around the "impossible to automatically filter mail outside of inbox" problem using tags (and the filtaquilla addon).
- Jörg and his team also adapted the search UI (CTRL+Shift+F). It is possible to make use of "complex searches"
Negative observations:
- issue 63
Speed. Filtering sometimes can take a little while. My new computer has new relatively up to date hardware (From 2020/2021) including a SSD and with many complex filters and many e-mails arriving in the inbox at the same time (e.g. after starting Betterbird), it can take a few seconds for messages to be moved into sub-folders. On the plus side though: As long as users refrain from adding complex filters, I would assume the speed to be comparable to original Thunderbird.Edit: Speed is great since a few months now. I believe my speed issues were caused by two conflicting filter rules and move operations. Unfortunately I am not able to reproduce what happened. Betterbird 102.14.0-bb39 (64-bit) is all good for now.
Recommendations:
- Porting the Betterbird complex filter UI to Thunderbird is recommended. (My personal opinion as user (I don't know about code quality!))
- Test filter performance. I read somewhere that the old filters engine was tested by filtering a million messages or something. :D Maybe something similar can be done here and compare the speed of the old with the new implementation.
Comment 79•2 years ago
|
||
(In reply to Thilo.Ertel from comment #78)
I have been using Betterbird for roughly half a year now with the new complex filters UI and it works very well.
Great work.
Is this feature compatible with bug 79525 and https://addons.thunderbird.net/de/thunderbird/addon/sieve/?src=ss ???
Comment 80•2 years ago
|
||
@Ulf Zibis
You can try Betterbird with the new UI yourself and test if it is compatible with Sieve.
I have never used Sieve before. Tried to set it up once, but was not able to connect. I believe my mail-provider does not support Sieve.
Comment 82•2 years ago
|
||
Yes, it's definitely something we want.
I looked and betterbird's solution and both code and UI are not the best.
Let's talk about this a bit in our next front-end meeting and find a way forward.
Updated•2 years ago
|
Comment 84•6 months ago
|
||
Just to ping and leave some relevant detail on this bug as there is currently code freeze in 128, and I am regularly getting users of my Add-ons quickFilters and FiltaQuilla requesting it.
Is this something we could attack for the next ESR? I am hoping that the Thunderbird code base will go on Github soon / this year and then I am open to contribute some patches around filters again, wouldn't mind being part of the team that implements this one; if you have a filters guy I can do requirements and QA as well if you like. PS: I have ported Thunderbird Filter Patches to Postbox before, but I haven't touched much C++ code in the last years, but getting better with ECMAScript, and am interested in getting started with Rust.
We might attack filter storage first, they really need some additional attributes (such as GUID, last edited, lasted used date, and custom attributes that can be added so we can expose this to Add-on developers later - in quickFilt4ers I have implemented a backup / restore feature but it has to match filters based on their names which is not idea) and would be much better stored as JSON rather than the current mess.
I think the Bb UI is somewhat useful, after some layout improvements that I requested:
hope the screenshot is visible (from Github)
Reporter | ||
Comment 85•6 months ago
|
||
As I wrote originally, I would still recommend LDAP filter syntax https://bugzilla.mozilla.org/show_bug.cgi?id=297852#c0 since it's lightweight and we already have code in libldap that correctly and efficiently parses such things. JSON is much bulkier and you'd still need to invent a syntax to represent the Boolean operators themselves.
Comment 86•6 months ago
|
||
(In reply to Howard Chu from comment #85)
As I wrote originally, I would still recommend LDAP filter syntax https://bugzilla.mozilla.org/show_bug.cgi?id=297852#c0 ...
What is the advantage of LDAP over Sieve [1]?
Many IMAP servers already have implemented it.
Does LDAP support server-side filtering?
[1] https://en.wikipedia.org/wiki/Sieve_(mail_filtering_language)
Comment 87•6 months ago
|
||
(In reply to Axel Grude from comment #84)
Just to ping and leave some relevant detail on this bug as there is currently code freeze in 128, and I am regularly getting users of my Add-ons quickFilters and FiltaQuilla requesting it.
Does QuickFilters or FilterQuilla support server-side filtering, e.g. by the Sieve protocol?
Comment 88•6 months ago
|
||
(In reply to Ulf Zibis from comment #87)
Does QuickFilters or FilterQuilla support server-side filtering, e.g. by the Sieve protocol?
No:
-
FiltaQuilla adds other search terms (such as regular expressions) and actions (play sound, run external program, detach attachments...) - one of the problems here is that filter stuff is still not async, which makes using API methods difficult. I am hoping that the Tb Core team will address the async problem within the ESR128 cycle, then we can make filter APIs for mail extensions.
-
quickFilters is a Management tool that supports creating (and auto-filling) filters (outlook style) through an assistant, so it builds on whatever Thunderbird has to offer. It also adds a toolbar to the message filters and some search functionality (find filters that apply to a folder)
Reporter | ||
Comment 89•6 months ago
|
||
(In reply to Ulf Zibis from comment #86)
(In reply to Howard Chu from comment #85)
As I wrote originally, I would still recommend LDAP filter syntax https://bugzilla.mozilla.org/show_bug.cgi?id=297852#c0 ...
What is the advantage of LDAP over Sieve [1]?
Many IMAP servers already have implemented it.
Does LDAP support server-side filtering?[1] https://en.wikipedia.org/wiki/Sieve_(mail_filtering_language)
Yes, LDAP supports server-side filtering, that is it's most heavily used function when serving an Address Book role.
It's important to be clear about what the aim is here. Boolean expressions in Filters is only targeting criteria for message selection, it has nothing to do with specifying what actions to take on selected messages. Sieve appears to be a larger scope, as it includes actions. I don't think anyone is proposing to replace MailNews' entire filter engine with Sieve.
Description
•