Background for Shawn's comments can be found here:

https://lucidworks.com/blog/2011/12/28/why-not-and-or-and-not/

Solr's query language is NOT strict boolean logic as explained
above. Although with proper grouping (parenthesizing) and tricks
like Shawn mentioned it can be pretty close.

Best,
Erick

On Fri, Sep 9, 2016 at 9:17 PM, Shawn Heisey <apa...@elyograg.org> wrote:
> On 9/9/2016 9:17 PM, Prasanna S. Dhakephalkar wrote:
>> Further search on net got me answer
>>
>> The query to be
>>
>> a_id:20 OR (*:* NOT a_id:*)
>>
>> I don't understand this syntax
>
> The basic problem here is that negative queries don't work.  If you're
> going to subtract X, you have to start with something (like all docs),
> or the result is nothing.
>
> For simple queries (just a single "-field:X" clause), Solr is able to
> detect the unworkable situation and implicitly add a "*:*" starting
> point, so the query works.
>
> When the query has ANY complexity, Solr's negative query detection isn't
> possible, and the query can't be fixed automatically, so it doesn't work.
>
> Thanks,
> Shawn
>

Reply via email to