lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Koelliker <IKoelli...@axsone.com>
Subject Lucene query behavior using NOT
Date Fri, 06 Feb 2015 21:46:43 GMT
Hello,
I am trying to understand whether I am using the NOT operator correctly. I have the following
scenario:

Query 1 = body:(a OR NOT b)

This is parsed as:  (body:a) -(body:b) and finds 96,620 hits

Query 2 = body:(a OR (*:* AND NOT b))

This is parsed as: (body:a) (+*:* -(body:b)) and finds 149,438 hits

Query 3 = body:(a AND NOT b)

This is parsed as:  +(body:a) -(body:b) and finds 96,620 hits

Query 4 = body:(a AND (*:* AND NOT b))

This is parsed as:  +(body:a) +(+*:* -(body:b)) and finds the same 96,620 hits

Does anyone know the nuances when working with the NOT operator in terms of why query 1 and
query 2 return different hits whereas query 3 and query 4 return the same? Is there a correct
usage when you want to use NOT with AND/OR?

Thanks,
Ian

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message