lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Morus Walter <morus.wal...@tanto-xipolis.de>
Subject Query Parser AND / OR
Date Tue, 09 Dec 2003 09:57:51 GMT
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)

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

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


Mime
View raw message