Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using AND, OR and NOT in Solr Query

I am trying a Solr query which is like this

+field1:* AND (field2:1 OR field2:10) NOT(field3:value1 OR field3:value2)

But field3 part of the query is not making any impact. It still brings record which has value1 or value2 in field3

Why is this?

like image 392
Riz Avatar asked Dec 28 '22 09:12

Riz


2 Answers

Try this

+field1:* +(field2:1 OR field2:10) -(field3:value1 OR field3:value2)
like image 153
Nakkala Avatar answered Dec 30 '22 21:12

Nakkala


I think a AND / OR is missing between the two last blocks. It would then become something like :

+field1:* AND (field2:1 OR field2:10) AND NOT(field3:value1 OR field3:value2)
like image 30
Guillaume Lebourgeois Avatar answered Dec 30 '22 23:12

Guillaume Lebourgeois