MBOX-Line: From tss at iki.fi  Wed Dec 20 11:34:18 2006
To: imap-protocol@u.washington.edu
From: Timo Sirainen <tss@iki.fi>
Date: Fri Jun  8 12:34:38 2018
Subject: [Imap-protocol] Searching
In-Reply-To: <alpine.OSX.0.81.0612201018450.10225@pangtzu.panda.com>
References: <1166603479.22214.298.camel@hurina>
	<alpine.OSX.0.81.0612201018450.10225@pangtzu.panda.com>
Message-ID: <1166643258.22214.350.camel@hurina>

On Wed, 2006-12-20 at 10:40 -0800, Mark Crispin wrote:
> On Wed, 20 Dec 2006, Timo Sirainen wrote:
> > RFC says: "In all search keys that use strings, a message matches the
> > key if the string is a substring of the field."
> > 
> > Strictly reading this, it means that the SEARCH command can't really be
> > optimized with most of the normal search index algorithms/libraries,
> > because they support only matching from the beginning of words.
> > 
> > So, in case I wanted to use such indexes, what do you think I should do?
> 
> Implement SEARCH according to the IMAP specification.  If a library search 
> routine does not fufill the IMAP specification, then it is unsuitable for 
> use with IMAP SEARCH.

That's what I was thinking, just wanted to make sure that I wouldn't
waste time on doing it in a more complex way than necessary.

> If you are worried about performance, I suggest that you look into one of 
> the optimizing algorithms for fast search.  UW and Cyrus use a Boyer-Moore 
> fast search which is quite a bit faster than the straightforward linear 
> search.

Optimizing the string search would help some, but for large mailboxes
it's still a bit too slow. People want instant search results
nowadays. :)

> > 2) Add some X-NONEXACT-BODY search extension. Or use COMPARATOR somehow?
> 
> The problem with one-server extensions is that nobody uses them.  Feel 
> free to do so anyway, as long as you implement the standard SEARCH 
> correctly; but it will languish in obscurity.

Perhaps. I think it depends on how badly mail admins want it. If it's
only a small s/BODY/X-NONEXACT-BODY/ replace for their webmail code,
it'll get usage at least within Dovecot community.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: This is a digitally signed message part
URL: <http://mailman13.u.washington.edu/pipermail/imap-protocol/attachments/20061220/ad8620f1/attachment.sig>
