Paul Sample
Paul Sample

Reputation: 11

SOLR query with multiple fields using Not Equals operator with OR returns wrong result

I am trying to perform a solr query with multiple query fields including a not equals operator.

Example query:

field1:abc OR -field2:def

The problem is the query returns results for an AND operation instead of an OR, as if the query was:

field1:abc AND -field2.def

Both queries always return the same result. What is the correct syntax to achieve a correct OR result?

I am currently using solr 3.5.

Thanks

Upvotes: 1

Views: 5627

Answers (2)

Abdulkadir Dalga
Abdulkadir Dalga

Reputation: 75

for field1:abc OR -field2:def this also works

-(-field1:abc AND field2:def) .

Upvotes: 0

Paige Cook
Paige Cook

Reputation: 22555

Maybe try the following:

field1:abc OR (*:* -field2:def) 

Upvotes: 4

Related Questions