What Morus is saying is right, an expression without parenthesis, when
interpreted, assumes terms on either side of an AND clause are compulsory
terms, and any terms on either side of an OR clause are optional. However,
if you combine AND and OR in an expression, the optional terms have no
effect because the others are compulsory.

What needs to be done is that the query parse should process any query
string that has AND, and "put brackets" round it first. As it stands it is
no use, as the OR does not work in the way you would think. AND should be
given implicit priority.


-----Original Message-----
From: Morus Walter [mailto:[EMAIL PROTECTED]
Sent: 10 December 2003 09:01
To: Lucene Users List
Subject: Re: Query Parser AND / OR

Hi Dror,

thanks for your answer.
> >
> > I'm having problems understanding query parsers handling of AND and OR
> > if there's more than one operator.
> >
> > E.g.
> > a OR b AND c
> > gives the same number of hits as
> > b AND c
> > (only scores are different)
>
> This would make sense if all the document that have a also have both B
> and C in them.
>
Then the query should be equivalent to (a OR b) AND c.
But it isn't. For specific a, b and c I get 766 hits for a OR b AND c
and 1086 for (a OR b) AND c.

> >
> > and
> > a AND b OR c AND d
> > seems to be equivalent to
> > a AND b AND C AND d
> >
>

a OR b AND c -> a +b +c
      4 documents found
        a b c
        a b c d
        b c
        b c d
(a OR b) AND c -> +(a b) +c
      6 documents found




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to