<?xml version="1.0" encoding="UTF-8"?> 
<?xml-stylesheet href="https://dev.horde.org/themes/horde//default/feed-rss.xsl" type="text/xsl"?> 
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> 
 <channel> 
  <title>OR-combination for flags</title> 
  <pubDate>Fri, 10 Apr 2026 18:27:15 +0000</pubDate> 
  <link>https://bugs.horde.org/ticket/6825</link> 
  <atom:link rel="self" type="application/rss+xml" title="OR-combination for flags" href="https://bugs.horde.org/ticket/6825/rss" /> 
  <description>OR-combination for flags</description> 
 
   
   
  <item> 
   <title>testing IMP 4.2 with most of the other current modules. Am I</title> 
   <description>testing IMP 4.2 with most of the other current modules. Am I correct that searches are built by one of the following two modes? 



All Queries: AND( AND(CRIT_1, CRIT_2, ...) AND(FLAG_1, FLAG_2, ...) )

Any Queries: AND(  OR(CRIT_1, CRIT_2, ...) AND(FLAG_1, FLAG_2, ...) )





My understanding is that it is not possible to do imap searches for OR-combination of flags, correct? (e.g. all new OR unanswered messages). 



That could be fixed by making &quot;search flags&quot; on par with the &quot;search criteria&quot;, i.e. applying the all/any-switch to flags as well. Even better: provide three all/any-switches for search criteria, search flags and their combination:



AND/OR(  AND/OR(crit_1, crit_2, ...), AND/OR(FLAG_1, FLAG_2, ...) )



That would enormously extend the space of possible searches by still avoiding a complex GUI for the general nesting of logical operators.







Furthermore two little glitches in the current GUI:

 - In &quot;recent searches&quot;, the flags are not mentioned.

 - &quot;Search Flags&quot; for all the imap flags, but &quot;flagged message&quot;

   for only the important flag. 





Martin

</description> 
   <pubDate>Tue, 03 Jun 2008 15:39:50 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6825#t45877</link> 
  </item> 
   
  <item> 
   <title>&gt; My understanding is that it is not possible to do imap sea</title> 
   <description>&gt; My understanding is that it is not possible to do imap searches for 

&gt; OR-combination of flags, correct? (e.g. all new OR unanswered 

&gt; messages).



Why not? A &quot;match any&quot; query, with multiple flags, should work fine...</description> 
   <pubDate>Tue, 03 Jun 2008 15:51:23 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6825#t45880</link> 
  </item> 
   
  <item> 
   <title>Though it doesn&#039;t seem to. Michael, it looks like if the onl</title> 
   <description>Though it doesn&#039;t seem to. Michael, it looks like if the only criteria you choose are flags, the search doesn&#039;t match anything, whether it&#039;s an AND or an OR search.</description> 
   <pubDate>Tue, 03 Jun 2008 15:53:37 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6825#t45881</link> 
  </item> 
   
  <item> 
   <title>Changes have been made in CVS for this ticket:

  http://cvs</title> 
   <description>Changes have been made in CVS for this ticket:

  http://cvs.horde.org/diff.php/imp/lib/Search.php?r1=1.113&amp;r2=1.114&amp;ty=u
  http://cvs.horde.org/diff.php/imp/search.php?r1=2.196&amp;r2=2.197&amp;ty=u
  http://cvs.horde.org/diff.php/imp/templates/search/search.html?r1=1.29&amp;r2=1.30&amp;ty=u</description> 
   <pubDate>Fri, 06 Jun 2008 05:50:45 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6825#t46030</link> 
  </item> 
   
  <item> 
   <title>&gt; testing IMP 4.2 with most of the other current modules. Am</title> 
   <description>&gt; testing IMP 4.2 with most of the other current modules. Am I correct 

&gt; that searches are built by one of the following two modes?

&gt;

&gt; All Queries: AND( AND(CRIT_1, CRIT_2, ...) AND(FLAG_1, FLAG_2, ...) )

&gt; Any Queries: AND(  OR(CRIT_1, CRIT_2, ...) AND(FLAG_1, FLAG_2, ...) )



yes.



&gt; My understanding is that it is not possible to do imap searches for 

&gt; OR-combination of flags, correct? (e.g. all new OR unanswered 

&gt; messages).



With my recent changes, it should now be possible to do this.



&gt; That could be fixed by making &quot;search flags&quot; on par with the &quot;search 

&gt; criteria&quot;, i.e. applying the all/any-switch to flags as well. Even 

&gt; better: provide three all/any-switches for search criteria, search 

&gt; flags and their combination:



This is what I have done - I have moved the search flags into the search criteria.  Please test and check for smoke, etc.



&gt; AND/OR(  AND/OR(crit_1, crit_2, ...), AND/OR(FLAG_1, FLAG_2, ...) )

&gt;

&gt; That would enormously extend the space of possible searches by still 

&gt; avoiding a complex GUI for the general nesting of logical operators.



This was talked about long ago but isn&#039;t easily done - how do you &quot;lump&quot; queries together?  For example, how do I specify that I want (A AND B) OR (C AND D) - the result must contain A/B pairs or C/D pairs - not (A AND B OR C) AND D - the result must contain D and must contain either A/B pair or C.  In other words, nobody has come up with an elegant way of making the UI handle &#039;parentheses&#039; so, thus, the reason we have either all AND or all OR searches.



&gt; Furthermore two little glitches in the current GUI:

&gt;  - In &quot;recent searches&quot;, the flags are not mentioned.



This has been fixed as a result of the new code (since it pretty much uses the same code previously used for the search criteria).



&gt;  - &quot;Search Flags&quot; for all the imap flags, but &quot;flagged message&quot;

&gt;    for only the important flag.



I don&#039;t understand what this is saying.  There is no &quot;important&quot; IMAP flag, only a &quot;flagged for followup&quot; flag.</description> 
   <pubDate>Fri, 06 Jun 2008 05:59:59 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6825#t46031</link> 
  </item> 
   
  <item> 
   <title>&gt; Though it doesn&#039;t seem to. Michael, it looks like if the o</title> 
   <description>&gt; Though it doesn&#039;t seem to. Michael, it looks like if the only 

&gt; criteria you choose are flags, the search doesn&#039;t match anything, 

&gt; whether it&#039;s an AND or an OR search.



I can&#039;t reproduce this, but it could be because the new code fixes or it could be because I don&#039;t understand what you are trying to say here.</description> 
   <pubDate>Fri, 06 Jun 2008 06:00:42 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6825#t46032</link> 
  </item> 
   
  <item> 
   <title>Thinking about this a second... this is going to break virtu</title> 
   <description>Thinking about this a second... this is going to break virtual folders with flags, so it is doubtful that this is something that can go into IMP 4.2.</description> 
   <pubDate>Fri, 06 Jun 2008 06:03:10 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6825#t46033</link> 
  </item> 
   
  <item> 
   <title>&gt; This was talked about long ago but isn&#039;t easily done



uh</title> 
   <description>&gt; This was talked about long ago but isn&#039;t easily done



uh, haven&#039;t found that discussion ...



&gt; how do you &quot;lump&quot; queries together?  For example, how do I 

&gt; specify that I want (A AND B) OR (C AND D) - the result must

&gt; contain A/B pairs or C/D pairs - not (A AND B OR C) AND D  

&gt; the result must contain D and must contain either A/B pair or C.  



Yes, indeed. 



&gt; In other words, nobody has come up with an elegant way 

&gt; of making the UI handle &#039;parentheses&#039; so, thus, the reason 

&gt; we have either all AND or all OR searches.



I do not propose to allow arbitrary nesting/parentheses, as the GUI would become very complex (drag and drop for some indention pops into my mind). You pointed this out as well. However, if you have two fixed and, therefore, only three logical operators, the GUI should not be too complicated:



Search Criteria (O OR  X AND)

    Criteria 1

    Criteria 2

    Criteria 3



X  Match Criteria AND Flags

O  Match Criteria OR  Flags



Search Flags (O OR  X AND)

    Flag 1

    Flag 2

    Flag 3

 

(with O unselected and X default option)



This GUI keeps up the differentiation between Criteria and Flags, which, in general, is fine for me. It does not allow every logic combination of sub-searches, but a lot more than before: the set of new searches would be a real superset of the current searches and the searches possible with your or-patches.



I do not know about elegance, and I do not know whether everybody finds this GUI as intuitive as I do. Furthermore, I cannot say that this proposed GUI is the non-plus-ultra (free nesting would be), but IMHO(!) it is much superior to the current and to your patched version. Ordering them would give for me:



    (and/or) and (and)   &lt;    and/or    &lt;   (and/or) and/or (and/or)    &lt;    ??



&gt; Thinking about this a second... this is going to break 

&gt; virtual folders with flags, so it is doubtful that this 

&gt; is something that can go into IMP 4.2.



For already saved searches in &quot;old&quot; format (making trouble for your patches as you mentioned), using the X-selection as default for 2nd and 3rd operator would keep up the old behavior. Just saving the searches in new format if changed, or writing a little upgrade script for the DB should be easy.



I do wait with smoke-testing your already provided patches until I get feedback to this proposal. If you reject it, I&#039;ll go with your patches, as saved searches are not a problem for my users.





ad &quot;flagged for followup&quot;: ack, forget what I said.</description> 
   <pubDate>Fri, 06 Jun 2008 12:20:21 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6825#t46049</link> 
  </item> 
   
  <item> 
   <title>&gt;&gt; Though it doesn&#039;t seem to. Michael, it looks like if the </title> 
   <description>&gt;&gt; Though it doesn&#039;t seem to. Michael, it looks like if the only

&gt;&gt; criteria you choose are flags, the search doesn&#039;t match anything,

&gt;&gt; whether it&#039;s an AND or an OR search.

&gt;

&gt; I can&#039;t reproduce this, but it could be because the new code fixes or 

&gt; it could be because I don&#039;t understand what you are trying to say 

&gt; here.



The new code fixes it. So it would be great if the changes could be separated into bugfix and whatever is backwards incompatible.</description> 
   <pubDate>Sat, 07 Jun 2008 03:12:28 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6825#t46079</link> 
  </item> 
   
  <item> 
   <title>I like the idea of automatically detecting old-style rules, </title> 
   <description>I like the idea of automatically detecting old-style rules, and converting them on the fly to the new format.</description> 
   <pubDate>Sat, 07 Jun 2008 07:35:45 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6825#t46080</link> 
  </item> 
   
  <item> 
   <title>Just read my earlier post again and think I should clarify t</title> 
   <description>Just read my earlier post again and think I should clarify the relation between the different versions of search:



&gt;     (and/or) and (and)   &lt;    and/or    &lt;   (and/or) and/or (and/or)     &lt;    ??



The order I gave represents the usefulness (in my eyes!) of the original search, Michael´s patched search, and my proposed search, not their expressiveness. 



Michael´s patched version describes a set of searches not completely covering the original, so no backward compatibility. However, it has increased usability by exhibiting a better comprehensibility for the users.



The proposed version is a superset of both the original and the Michael´s, so backward compatibility is given (once the save format is handled), although it has a slightly more complex GUI. For me, it is a good trade-off between expressiveness and usability.



I vote for my version ;o)) But I would be happy with Michael´s version as well, which is a clean approach seen in many mail clients. I just tested current CVS and everything works well.



&gt;&gt; Furthermore two little glitches in the current GUI:

&gt;&gt;  - In &quot;recent searches&quot;, the flags are not mentioned.

&gt; This has been fixed as a result of the new code [..]



Yes, fixed. Talking about enhancements, may I suggest to delete empty search fields from this display (and storage): they are unnecessary clustering the string with, e.g., &quot;To for ´´ in INBOX&quot;, and new searches have a lot of empty fields to offer quick access to the different header fields.





  Martin</description> 
   <pubDate>Sat, 07 Jun 2008 12:27:05 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6825#t46081</link> 
  </item> 
   
  <item> 
   <title>Changes have been made in CVS for this ticket:

http://cvs.h</title> 
   <description>Changes have been made in CVS for this ticket:

http://cvs.horde.org/diff.php/imp/lib/Search.php?r1=1.114&amp;r2=1.115&amp;ty=u
http://cvs.horde.org/diff.php/imp/search.php?r1=2.197&amp;r2=2.198&amp;ty=u</description> 
   <pubDate>Mon, 09 Jun 2008 23:53:41 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6825#t46144</link> 
  </item> 
   
  <item> 
   <title>Changes have been made in CVS for this ticket:

http://cvs.h</title> 
   <description>Changes have been made in CVS for this ticket:

http://cvs.horde.org/diff.php/imp/lib/Search.php?r1=1.37.10.42&amp;r2=1.37.10.43&amp;ty=u
http://cvs.horde.org/diff.php/imp/locale/en_US/help.xml?r1=1.53.6.13&amp;r2=1.53.6.14&amp;ty=u
http://cvs.horde.org/diff.php/imp/search.php?r1=2.128.2.29&amp;r2=2.128.2.30&amp;ty=u
http://cvs.horde.org/diff.php/imp/templates/search/search.html?r1=1.28.2.2&amp;r2=1.28.2.3&amp;ty=u</description> 
   <pubDate>Mon, 09 Jun 2008 23:59:27 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6825#t46147</link> 
  </item> 
   
  <item> 
   <title>I&#039;ve added auto-updating for old VF rules, so the main eleme</title> 
   <description>I&#039;ve added auto-updating for old VF rules, so the main element of this ticket has been completed.



&gt; Just read my earlier post again and think I should clarify the 

&gt; relation between the different versions of search:

&gt;

&gt;&gt;     (and/or) and (and)   &lt;    and/or    &lt;   (and/or) and/or (and/or) 

&gt;&gt;     &lt;    ??

&gt;

&gt; The order I gave represents the usefulness (in my eyes!) of the original search, Michael´s patched search, and my proposed search, not their expressiveness.

&gt;

&gt; Michael´s patched version describes a set of searches not completely covering the original, so no backward compatibility. However, it has increased usability by exhibiting a better comprehensibility for the users.

&gt;

&gt; The proposed version is a superset of both the original and the Michael´s, so backward compatibility is given (once the save format is handled), although it has a slightly more complex GUI. For me, it is a good trade-off between expressiveness and usability.



BC is *not* given with this format.  It would require complex retooling of both current virtual folder rules and development of a new, internal format to save the rules.  This is much more than a trivial change.



It is a worthy goal, just not one that appears appropriate for IMP 4.2.  Moving to another ticket.</description> 
   <pubDate>Tue, 10 Jun 2008 00:00:21 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6825#t46148</link> 
  </item> 
   
   
 
 </channel> 
</rss> 
