[Xapian-discuss] Design-question/problem

Olly Betts olly at survex.com
Sun Aug 30 06:25:26 BST 2009


On Fri, Aug 28, 2009 at 01:23:01PM +0100, John Leach wrote:
> Quick example, if each book has a unique id of the form "book88", then
> the search could look like:
> 
> "book88 AND (quick brown fox)"
> 
> or perhaps: "+book88 quick brown fox"

Only is the default operator is OP_AND (in which case the "+" is
superfluous).  If it is OP_OR, then that matches every page in book88,
since it is:

    book88 AND_MAYBE (quick OR brown OR gox).

> I believe that the most efficient way to do the query would actually be
> to use the OP_FILTER query on the book id term - not sure if you can do
> this via the query parser, so you'd have to build that yourself.

It's not so much "most efficient", as "avoiding the filter affecting the
weights".  To do this, add "book:" as a boolean filter, and then the
QueryParser will apply it for you using OP_FILTER - see:

http://xapian.org/docs/apidoc/html/classXapian_1_1QueryParser.html#ac4192166cf335462bbfa8f1f17a667c

Cheers,
    Olly



More information about the Xapian-discuss mailing list