Solr supports purely negative requests. They do this essentially by expanding the net negative to something like:
*:* -startDate:[* TO *]
However, what you combine in BooleanQuery, I do not believe that it applies such logic. A negative query in lucene does not receive anything, but rather filters out matches caused by other, positive, query conditions. This is different from SQL queries, which in a sense begin with an implicit *:* or a full table of results and allow you to bypass it.
I believe that your OR effectively ignored, since, strictly speaking, it does not make sense in the context. Typically, OR is just syntactic sugar, I think ( field:this OR field:that equivalent to field:this field:that ).
So, actually your query is: startDate:[* TO NOW/DAY+1DAY] -startDate:[* TO *] , which makes the results more obvious. When you wrap it in parentheses, each terminological request is processed separately, and you get access to solr support for lone negative requests.
It is much better to remember storing the default value if you need to look for unset / null values. *:* , and as a result, pure negative queries like this should scan the entire index, and therefore run very poorly. Providing a default value will improve performance and prevent this confusing situation.
source share