MBOX-Line: From bill.shannon at sun.com  Thu Jan 29 10:56:07 2009
To: imap-protocol@u.washington.edu
From: Bill Shannon <bill.shannon@sun.com>
Date: Fri Jun  8 12:34:42 2018
Subject: [Imap-protocol] SEARCH OR question
Message-ID: <4981FBC7.9040509@sun.com>

What's the correct syntax to do a SEARCH for an OR of three terms?
I've been using:

SEARCH OR OR HEADER Message-ID id1 HEADER Message-ID id2 HEADER Message-ID id3

RFC 3501 says:

       When multiple keys are specified, the result is the intersection
       (AND function) of all the messages that match those keys.  For
       example, the criteria DELETED FROM "SMITH" SINCE 1-Feb-1994 refers
       to all deleted messages from Smith that were placed in the mailbox
       since February 1, 1994.  A search key can also be a parenthesized
       list of one or more search keys (e.g., for use with the OR and NOT
       keys).

How would this work with OR?

SEARCH OR (HEADER Message-ID id1 HEADER Message-ID id2 HEADER Message-ID id3)

That doesn't match the BNF for OR.

SEARCH OR HEADER Message-ID id1 (HEADER Message-ID id2 HEADER Message-ID id3)

Are the multiple terms inside the parens combined using OR because they're
part of an OR key?  Or are they combined with AND because they're multiple
keys (first rule above)?  I assume the latter because there's no AND key
and otherwise there would be no way to express that case.


Assuming the first syntax at the top is correct, it appears that Exchange
2003 fails with more than two terms in OR.  Anyone know if that's a known
bug?  I can't find anything in the Microsoft knowledge base.

(A JavaMail customer reported this problem, I don't use Exchange myself.)



