On 5/21/2020 12:25 PM, Jochen Barth wrote:
> why does +(-x_ss:y) finds 0 docs,
> while -(+x_ss:y) finds many docs?
> Ok... +(*:* -x_ss:y) works, too, but I'm a bit surprised.
Purely negative queries, if that is what ultimately makes it to Lucene,
do not work.
The basic problem is that if you start with nothing and then subtract
something, you get nothing.
When a purely negative query that's VERY simple is provided, Solr is
able to detect the situation and implicitly add a starting point of all
docs. You'll probably find that the following query (which is missing
the parentheses compared to your first example) will work because Solr
is capable of detecting and fixing the problem itself:
With parentheses the query is too complex for the detection I described
to work, and the constructed Lucene query remains purely negative.
Your third example is the correct way to construct a purely negative
query so that it is guaranteed to work.