lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dror Matalon <d...@zapatec.com>
Subject Re: Query Parser AND / OR
Date Tue, 09 Dec 2003 18:49:35 GMT
On Tue, Dec 09, 2003 at 10:57:51AM +0100, Morus Walter wrote:
> Hi,
> 
> 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.

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

That's not what I get. 
http://www.fastbuzz.com/search/results.jsp?query=dean+AND+kerry+AND+clark+AND+gephardt&days=
returns 479 items
but
http://www.fastbuzz.com/search/results.jsp?query=dean+AND+kerry+OR+clark+AND+gephardt&days=
returns 564 items which indicates that the OR does make a difference.
As expcted, you end up getting more items with the OR.

Regards,

Dror

> which doesn't seem logical to me.
> 
> I'd expect to have AND higher precedence than OR (as a logical AND / OR in 
> C or Java) so that a OR b AND c would be equivalent to a OR (b AND c)
> and a AND b OR c AND d equivalent to (a AND b) OR (c AND d)
> 
> 
> When I look at the query parsers sources, I find, that -- unless paranthesis
> are used -- all these terms are added to one boolean query, and the
> AND operator makes the term left and right of it required (unless there
> are NOT operators making them prohibited).
> So 
> a OR b AND c gives one boolean query where  b and c are required, whereas
> a is not.
> a AND b OR c AND d produces a boolean query where a, b, c and d are required,
> which is indeed the same as a AND b AND c AND d.
> 
> 
> Should this be considered a bug?
> 
> greetings
> 	Morus
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 

-- 
Dror Matalon
Zapatec Inc 
1700 MLK Way
Berkeley, CA 94709
http://www.fastbuzz.com
http://www.zapatec.com

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Mime
View raw message