lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: Use boolean operator "-", the result is incorrect
Date Wed, 08 Apr 2020 17:45:14 GMT
: Solr/Lucene do not employ boolean logic. See Hossman’s excellent post:
: 
: https://lucidworks.com/post/why-not-and-or-and-not/
: 
: Until you internalize this rather subtle difference, you’ll be surprised. A lot ;).
: 
: You can make query parsing look a lot like boolean logic by carefully using parentheses…

Yup.  and to circle back to the original request...

: >>>>>>> id, name_s, age_i
: >>>>>>> 1, a, 10
: >>>>>>> 2, b, 10
: >>>>>>> Use the following query syntax:
: >>>>>>> -name_s:a OR age_i:10

tht says "Find all docs where age==10, then exclude docs where name==a

If what you want is "all docs where name!=a, combined with all docs where 
age==10" that would be...

	(*:* -name_s:a) age_i:10


-Hoss
http://www.lucidworks.com/
Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message