It's my pet peeve. Try
?q={!parent which=content_type:activity}(schedule.weekday:1) OR
has_schedules:false&debugQuery=true
vs
?q= {!parent which=content_type:activity}(schedule.weekday:1) OR
has_schedules:false&debugQuery=true
and you'll see how space matters.
The pro's way is to

?q={!parent which=content_type:activity v=$childq} has_schedules:false
&debugQuery=true&childq=schedule.weekday:1

Also check this, it deserves.

https://lucidworks.com/blog/2009/03/31/nested-queries-in-solr/Why Not AND,
OR, And NOT? | Lucidworks.com
<https://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwjF34DJ387RAhWKKcAKHQiFCDAQFggmMAA&url=https%3A%2F%2Flucidworks.com%2Fblog%2F2011%2F12%2F28%2Fwhy-not-and-or-and-not%2F&usg=AFQjCNH5ilVhXIevavTAURQuLzTZORbTvQ&bvm=bv.144224172,d.bGs>
http://blog-archive.griddynamics.com/2013/12/grandchildren-and-siblings-with-block.html


On Thu, Jan 19, 2017 at 7:33 PM, Ivan Bianchi <i...@wikiloc.com> wrote:

> I hope someone can help me because I have spent too many time looking for
> this issue :(
>
> I have 2 kind of documents related with an 1-n relation, in my example this
> is 1 activity has many schedules.
> To achieve this I have some inner child document with schedule fields
> inside the activity document. The identifier field of the document is
> called content_type.
>
> In the activity I have a boolean field to detect if the document has
> children (schedules) called 'has_schedules'.
>
> I'm trying to find the documents whose children have a weekday = 1 OR they
> don't have children. Here's the filter query:
> "{!parent which=content_type:activity}(schedule.weekday:1)" OR
> has_schedules:false
>
> I don't understand how the " char works in here, wherever I enclose the
> condition with " char, Solr ignores it. For example the previous query is
> equal to has_schedules:false, on the contrary I only get the first
> condition. Also, if I use the "(" it gives me a syntax error.
> The other issue here, is that if I remove the " chars, Solr gets the second
> condition (has_schedules:false) as part of the nested child query, which
> implies an error as this is a parent's field.
>
> Thank you for any help,
>
>
> --
> Ivan
>



-- 
Sincerely yours
Mikhail Khludnev

Reply via email to