Timo Sirainen | 19 Aug 2012 04:57
Picon
Picon
Favicon

Search extensions

I'm thinking about adding at least one new SEARCH command extension to Dovecot: ability to search from any
headers in the mail, including MIME headers in the body. So the idea is that you could somewhat quickly ask
e.g. "show me all mails with pdf attachments":

a search or x-anyheader application/pdf x-anyheader .pdf
b fetch $ bodystructure

The client can verify the results with the fetch. The "x-anyheader" can already be implemented without
changes to full text search plugin, because all backends store message/MIME headers and body text separately.

So, questions for the list, especially client developers:

1) What's a better name for x-anyheader? :)

2) Any other ideas about search extensions you'd want to see? Maybe I could get this standardized at some point.

I think one other thing missing has been "show me messages that have attachments". I've thought about maybe
creating a $hasattachments keyword for that, which the server could automatically set for new mails that
it thinks has attachments (and clients can set/unset the keyword if wanted).

Sean Kamath | 19 Aug 2012 08:47

Re: Search extensions


On Aug 18, 2012, at 7:57 PM, Timo Sirainen wrote:

> I'm thinking about adding at least one new SEARCH command extension to Dovecot: ability to search from any
headers in the mail, including MIME headers in the body. So the idea is that you could somewhat quickly ask
e.g. "show me all mails with pdf attachments":
> 
> a search or x-anyheader application/pdf x-anyheader .pdf
> b fetch $ bodystructure
> 
> The client can verify the results with the fetch. The "x-anyheader" can already be implemented without
changes to full text search plugin, because all backends store message/MIME headers and body text separately.
> 
> So, questions for the list, especially client developers:
> 
> 1) What's a better name for x-anyheader? :)
> 
> 2) Any other ideas about search extensions you'd want to see? Maybe I could get this standardized at some point.
> 
> I think one other thing missing has been "show me messages that have attachments". I've thought about
maybe creating a $hasattachments keyword for that, which the server could automatically set for new
mails that it thinks has attachments (and clients can set/unset the keyword if wanted).

At work we've flipped to Google mail (I run Dovecot at home).  99.9% of the time I just cry.

Once feature of their search capability that sometimes is nice is the ability to not only see if it has an
attachment (has:attachment) but the ability to search for the attachments by a specific name
(filename:<text>).  That can be, and has proven, useful.  I suspect this could turn into a nightmare,
however.  Ditto something like "has N attachments" (sometime I dearly wish I had at times -- I want to find
that damn message with like 10 attachments).  Or math around number of attachments.
(Continue reading)

Timo Sirainen | 19 Aug 2012 13:10
Picon
Picon
Favicon

Re: Search extensions

On 19.8.2012, at 9.47, Sean Kamath wrote:

>> I'm thinking about adding at least one new SEARCH command extension to Dovecot: ability to search from
any headers in the mail, including MIME headers in the body. So the idea is that you could somewhat quickly
ask e.g. "show me all mails with pdf attachments":
>> 
>> a search or x-anyheader application/pdf x-anyheader .pdf
>> b fetch $ bodystructure
>> 
>> The client can verify the results with the fetch.

> Once feature of their search capability that sometimes is nice is the ability to not only see if it has an
attachment (has:attachment) but the ability to search for the attachments by a specific name
(filename:<text>).  That can be, and has proven, useful.  I suspect this could turn into a nightmare,
however.  Ditto something like "has N attachments" (sometime I dearly wish I had at times -- I want to find
that damn message with like 10 attachments).  Or math around number of attachments.

Actually searching by attachment filename was also in my requirements list, but I forgot to mention it. It
can anyway be done the same way as the pdf example above. The bodystructure reply includes attachment
filenames. Of course you'll still need a client that can give a nice UI for those..

Michael M Slusarz | 21 Aug 2012 19:31

Re: Search extensions

Quoting Timo Sirainen <tss <at> iki.fi>:

> The client can verify the results with the fetch. The "x-anyheader"  
> can already be implemented without changes to full text search  
> plugin, because all backends store message/MIME headers and body  
> text separately.
>
> So, questions for the list, especially client developers:
>
> 1) What's a better name for x-anyheader? :)

Maybe X-ALLHEADERS?  X-ANYHEADER seems ok also.  Either one, if  
properly documented, would be easy enough to implement (I know that I  
personally never implement any IMAP command without staring at the  
RFCs so if you wanted to name it X-FUZZYWUZZY, that would also be fine).

> I think one other thing missing has been "show me messages that have  
> attachments". I've thought about maybe creating a $hasattachments  
> keyword for that, which the server could automatically set for new  
> mails that it thinks has attachments (and clients can set/unset the  
> keyword if wanted).

I think you are entering a *very* slippery slope when it comes to this  
feature.  Because I believe that determination of what is an  
"attachment" is necessarily a client (read: UI) question, not a server  
question.  See, e.g.:

http://markmail.org/message/q4mjgbcxks5j4ue6

michael
(Continue reading)


Gmane