MBOX-Line: From snowjn at aol.com  Tue Mar 13 06:11:00 2007
To: imap-protocol@u.washington.edu
From: John Snow <snowjn@aol.com>
Date: Fri Jun  8 12:34:38 2018
Subject: [Imap-protocol] SEARCH restricted to one mailbox?  Extensions?
In-Reply-To: <1173743673.9167.65.camel@hurina>
References: <07Mar12.152936pst."57996"@synergy1.parc.xerox.com>
	<1173743673.9167.65.camel@hurina>
Message-ID: <45F6A2E4.3060502@aol.com>

tss@iki.fi wrote:
> On Mon, 2007-03-12 at 16:29 -0700, Bill Janssen wrote:
>   
>> I basically want to be able to do searches across my entire mail
>> database, instead of just folder-by-folder, and I'm wondering how to
>> plaster that into the protocol.  I suppose one way would be to present
>> all the mail as one tricky folder which normally contains one message,
>> but responds to SEARCH over it by suddenly filling itself with the
>> results of the search, sending an untagged EXISTS, and sending them
>> back to the client.  The mailbox would gradually fill up with search
>> results; I'd have to expire them and send EXPUNGES periodically.
>>     
>
> That's a pretty nice idea, I think I'll do something similar if/when I
> implement support for searching multiple mailboxes :) The way I'd do it
> is:
>
>  - Have one "Search all folders" mailbox
>  - It has zero messages initially
>  - SEARCH done inside it
>    1) EXPUNGEs all the existing messages if there are any (although
> unless UID SEARCH is done, the EXPUNGEs can't be sent to client yet)
>    2) Adds all the matched messages virtually to the mailbox, and
> returns EXISTS with the new message count (includes the old messages
> with non-UID SEARCH)
>    3) Send SEARCH result after the EXISTS reply with listing all the new
> messages.
>
> Hmm. I guess this could be generalized to be a virtual folder where the
> search rule gets updated by the SEARCH command.
>
> There also exists a draft for searching multiple mailboxes:
> draft-melnikov-imapext-multimailbox-search-01.txt
>   

How about combining the multiple mailbox search with a select command to 
create a temporary mailbox view that contains the search result?  Since 
it doesn't exists as a listable mailbox, then it can't be the 
destination for a copy command, avoiding any issue of which underlying 
mailbox should be the destination.  The untagged exists response 
response would show the number of hits to the search query.  Also, the 
result set could be referenced by sequence number instead of the 
individual UIDs as returned by the standard search command.

snow.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman13.u.washington.edu/pipermail/imap-protocol/attachments/20070313/5d0c9329/attachment.html>
