On 8/23/2018 1:12 PM, Antelmo Aguilar wrote:
I asked this question in the IRC channel, but had to leave so was not able
to wait for a response. So sending it through here instead with the hopes
that someone can give me some insight on the issue I am experiencing.
So in our Solr setup, we use the Solr Export request handler. Our users
are able to construct Not queries and export the results. We were testing
this feature and noticed that Not queries do not return anything, but
normal queries do return results. Is there a reason for this or am I
missing something that will allow NOT queries to work with the Export
handler?
I would really appreciate the help.
Purely negative queries do not work. The reason is that a negative
query says "subtract X". But if you don't start with *SOMETHING*, then
you are subtracting from nothing, so you get nothing.
In some simple cases, Solr is able to detect purely negative queries and
implicitly add a starting point of *:* which is all documents. The
situations where this detection works are very limited.
To be absolutely sure that a negative query will work, start out with
the *:* all docs query. So instead of "-field:value" use "*:*
-field:value".
Thanks,
Shawn