[Xapian-discuss] email adress, searching for

Olly Betts olly at survex.com
Thu Apr 14 13:23:35 BST 2005


On Thu, Apr 14, 2005 at 02:04:43PM +0000, Ivar Bratberg wrote:
> Hello, I try to search for an e-mail,
> ex. sales at mysql.com
> But using queryparser
> 
>    qp.set_stemming_options("english");
>    qp.set_database(*pdatabase);
>    qp.set_default_op(Query::OP_AND);
> 
> query p=qp.parse_query(" \"\"sales at mysql.com\"\".")
> 
> cout << p.get_description
> still gives
> Query Xapian::Query((sale:(pos=1) PHRASE 3 mysql:(pos=2) PHRASE 3 
> com:(pos=3))
> 
> I doesn't see the email as one item

QueryParser expects an email address to be indexed as separate terms and
so searches for it as a phrase.  The benefit is that searches can match
the individual words - e.g. you can search for: mysql sales

A potential downside is that this doesn't actually require the "@" and
"." to be there, but in practice this is rarely a problem.  Google seems
to handle email addresses similarly, incidentally.

One real issue is that phrase searches can be more expensive in some
cases.  It's also a problem if you aren't indexing with positional
information.  I suspect we might benefit from generating a single term
for an email address (probably keeping the separate terms too).

Cheers,
    Olly



More information about the Xapian-discuss mailing list