[Xapian-discuss] Re: bug in query parser or wrong usage?

Michel Pelletier michel at dialnetwork.com
Thu Mar 30 18:58:31 BST 2006


Olly Betts wrote:
> On Fri, Mar 24, 2006 at 04:03:56PM -0800, Michel Pelletier wrote:
> 
>>but this one is different, seems to be treating OR like a positional term:
>>
>>
>>>>>p.parse_query("(x:3 OR x:4) x:1 y:2").get_description()
>>
>>'Xapian::Query((or:(pos=1) FILTER (X3 AND X4 AND X1 AND Y2)))'
> 
> 
> This is how boolean filter terms currently work.  You can't build
> boolean expressions from them.
> 
> I'd say this is a bug, but fixing it properly is a little involved 
> as I think it requires changes to the Query class itself, so it'll
> take a but of time.
> 
> A sort-of workaround is to use non-boolean prefixes instead of
> boolean ones.

I found success building the queries "by hand" composing them from 
nested xapian.Query objects.

 >>> Query(Query.OP_AND, Query(Query.OP_OR, Query("FOObar"), 
Query("FIZfaz")), Query("DINGdong")).get_description()
'Xapian::Query(((FOObar OR FIZfaz) AND DINGdong))'
 >>>

That got old after a while, which is why I whipped up xaql, so that I 
could issue these kinds of queries without constructing them raw.

-Michel




More information about the Xapian-discuss mailing list