[Xapian-discuss] QueryParser question

Olly Betts olly at survex.com
Mon Sep 14 16:08:02 BST 2009


On Wed, Sep 09, 2009 at 05:00:10AM +0100, Olly Betts wrote:
> On Mon, Sep 07, 2009 at 07:50:14PM -0400, Rich Lane wrote:
> > I'm using Xapian to index emails for the Sup mail client project. One of
> > our users reported that searching for messages with a query like
> > "label:foo label:starred" resulted in the union of all messages with the
> > labels 'foo' and 'starred', not the intersection. This was surprising
> > because the default_op in our QueryParser instance is set to OP_AND, so
> > combining a label and another field in a query would result in the
> > intersection.
> 
> The "default_op" is used for the probabilistic elements of the query,
> but the current documentation comment doesn't convey that at all well:
> 
>     Set the default boolean operator.
> 
> I'll replace it with something better.

Done.

> > I found http://trac.xapian.org/ticket/157 which explains
> > this behavior.
> 
> Yes.  This probably should be controllable on a per-prefix basis.  In
> cases where each document can only have a single attribute from a set
> (like "hostname" or "mime type") then the current behaviour is great
> (and AND makes no sense as no document could match) but if each document
> can have multiple attributes from the set then it's possible that AND is
> a better default (as in your example).

I've filed a ticket for this:

http://trac.xapian.org/ticket/402

Cheers,
    Olly



More information about the Xapian-discuss mailing list