[Xapian-discuss] QueryParser (I think) question

Andreas Marienborg andreas at startsiden.no
Wed May 23 07:45:53 BST 2007


On May 22, 2007, at 9:39 PM, Olly Betts wrote:

> On Tue, May 22, 2007 at 04:08:54PM +0200, Andreas Marienborg wrote:
>> On May 22, 2007, at 4:00 PM, James Aylett wrote:
>>> On Tue, May 22, 2007 at 02:34:42PM +0200, Andreas Marienborg wrote:
>>>
>>>> so I tried the following: "source:1 OR source:2", but that  
>>>> results in
>>>> the following query after
>>>> parsing:
>>>>
>>>> Xapian::Query((or:(pos=1) FILTER (S1 AND S2)))
>>>>
>>>> is that expected? am I trying to do something that I cannot do?  
>>>> or am
>>>> I just doing something wrong?
>>>
>>> It's not what I'd expect. The query parser came out of omega, whose
>>> documentation states that boolean terms are combined by OR for  
>>> similar
>>> prefixes, then AND for the different prefixes to create the overall
>>> FILTER clause. Looks like this documentation is no longer  
>>> correct :-/
>
> Actually, the "boolean terms" referred to there are ones specified as
> "B" CGI parameters to Omega.  Boolean-prefixed terms in the  
> QueryParser
> post-date it being extracted from Omega by quite some time.
>
> The QueryParser doesn't currently OR boolean-prefixed terms with the
> same prefix, though there is a "FIXME" comment suggesting that it
> probably should (in the absence of explicitly boolean operators that
> is).
>> But it is expected to ignore my OR and convert that to a "regular"  
>> term?
>>
>> if I omit the OR it produces  Xapian::Query((S1 AND S2))
>>
>> I have     $self->qp->set_default_op(OP_AND);
>>
>> in my setup, but commenting it out does no difference.
>>
>>
>> Is this a documentation problem, or a code-problem?
>
> Both, I guess.  It's a known limitation of the current handling of
> boolean prefixes in the QueryParser, which isn't mentioned in the
> documentation.
>
> Ironically, you can't currently use boolean prefixed terms in boolean
> expressions.  Someone reported this to this list, I think late last
> year but I can't find the mail currently.  Anyway, I couldn't see an
> easy way to fix it at the time, but it's certainly something we should
> fix, especially now 1.0.0 is out of the way.

Sounds swell. I am not a very avid C/C++ hacker, so don't know how  
much I can help, but if nothing else, I can test it :)

Thanks for your answers, and if there is any way I can contribute, I  
would love to do so.


- andreas




More information about the Xapian-discuss mailing list