Re: What to do about SEARCH?

Charles Cazabon <[email protected]> Thu, 6 Mar 2003 14:51:37 -0600
Newsgroups gmane.mail.bikini.devel
Message-ID <[email protected]>
Roger Merchberger <[email protected]> wrote:
> 
> >An alternative would be to only search the message header.  Is that even
> >useful?
> 
> Yes, for the reasons above. (well, for me, anyway)
> 
> >Then, if search is necessary, what form does it take?  Simple substring
> >matches?  Full-blown pcre?  Somewhere in between?
> 
> My python book's on order, so I don't know much about it yet, but how easy 
> is it to implement pcre searches?

Trivial.

> If it's simple, then I'd say have a 
> single-char tag or delimiter (say, slashes, just like perl) -- would that 
> make it farily easy to implement? Like this:
> 
> PCRE search is surrounded by /'s:
> 
> SEARCH /From: .*30below\.com/
> 
> would return any messages from anyone on 30below.com's domain

Actually, it wouldn't.  The following is legal rfc2822 but won't match that
regex:

  Foo: bar
  From: "Joe Bloggs"
    <[email protected]>
  To: "You" <you@yourdomain>
  ...

Regular expressions are not particularly well suited to searching mail header
fields.  I was thinking of perhaps giving it some more structure, and perhaps
a globbing interface.  i.e.

  SEARCH <folder-path> <header-pattern> <match-pattern>

So you could do this:

  SEARCH dir/qmail to,cc,resent-* *@30below.com

to search the To:, cc:, and Resent-<anything>: header fields for addresses
with that matching domain.  The search would be defined as case-insensitive as
most information in message headers is case insensitive.  You could limit your
search to a particular header field, or all fields with "*" as header-pattern,
or a list of fields as above.

> SEARCH 30below.com
> 
> would return all the messages with any header that contained that (in my 
> case, all of 'em...)

Which I would phrase as

  SEARCH dir/qmail * 30below.com

> >Lots of questions.  Few answers.
> 
> Sounds like Radio Shack...

"You've got questions.  We've got minimum wage staff who don't know a
capacitor from a cellular phone."

Charles
-- 
-----------------------------------------------------------------------
Charles Cazabon                           <[email protected]>
BikINI project website:    http://www.qcc.ca/~charlesc/software/bikini/
GPL'ed software available at:     http://www.qcc.ca/~charlesc/software/
-----------------------------------------------------------------------