lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stanislav Jordanov <ste...@sirma.bg>
Subject QueryParser issue
Date Fri, 19 Aug 2005 12:39:54 GMT
Recently I found that it makes difference whether your query looks like:
A AND NOT B
or it is
A AND (NOT B)
Some research using Luke showed that in the first case the query is 
rewritten as:
+A -B
while the second is rewritten as
+A +(-B)
after the usual "wtf?" I've recalled that there was a dicussion on this 
issue on the lucene uses list.
I found it and yes, it was explaining that QueryParser is rather 
primitive and does not take the usual
operator precedence into account.
Then I read the explanation of types of queries in the "Lucene in 
Action" and everything seemed clear for a moment,
except:
Why the two above mentioned queries return different results?
Is it because the first one means: "get all docs that contain A and do 
not contain B"
and the second one means "get all docs that contain A and intersect them 
with the docs returned from the query (-B)"
and (-B) as a pure negative query returns 0 results ?

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


Mime
View raw message