SOLR query with multiple fields using Not Equals o

2019-08-10 08:19发布

问题:

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

回答1:

Maybe try the following:

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


回答2:

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

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



标签: syntax solr