How can I query for parent documents, with child documents NOT having a certain field value?
E.g.: Let's say we have the following data structure:
{
"type_s": "book",
"id_l": 4294967298,
"title_s": "The Little Mermaid"
{
"type_s": "review",
"id_l": "4294967451",
"reviewer_s": "Freeman, Gordon",
"comment_s": "Great book!"
},
{
"type_s": "review",
"id_l": "4294967452",
"reviewer_s": "Denton, J.C.",
"comment_s": "My daughter loved it!"
}
},
{
"type_s": "book",
"id_l": 4294967298,
"title_s": "Lion King"
{
"type_s": "review",
"id_l": "4294967457",
"reviewer_s": "Woods, Susanne",
"comment_s": "One of the best!"
},
{
"type_s": "review",
"id_l": "4294967458",
"reviewer_s": "Denver, Michel",
"comment_s": "Liked the ending!"
}
},
{
"type_s": "book",
"id_l": 4294967298,
"title_s": "7 dwarves"
{
"type_s": "review",
"id_l": "4294967453",
"reviewer_s": "Freeman, Gordon",
"comment_s": "Great book!"
},
{
"type_s": "review",
"id_l": "4294967454",
"reviewer_s": "Delacroix, Marie",
"comment_s": "Too many dwarves!"
}
}
If i want to get all books having a review by "Freeman", I would do like this:
&fq={!parent which='type_s:book'}type_s:review AND reviewer_s:Freeman
This would give me two books as result.
But how would I do if I wanted to get all books NOT having a review by "Freeman"?
I've tried like this
&fq={!parent which='type_s:book'}type_s:review AND reviewer_s:(NOT Freeman)
this gives me 0 results
and this
&fq={!parent which='type_s:book'}type_s:review AND NOT reviewer_s:Freeman)
this gives me all parent documents.
Somewhat more promising is the following, which gives me some results (in my real use case)
&fq={!parent which='type_s:book'}type_s:review AND -reviewer_s:["" TO *]
Note that I tried the queries also with the searched term in single quotes.