I have a simple document in my Solr server:
{
"id": 1,
"type": "dad",
"_childDocuments_": [
{
"id": 2,
"name": "Alice"
},
{
"id": 3,
"name": "Bob"
}
]
}
I want to filter this document to retrieve only the "Alice" document, along with the parent document, excluding the other child, "Bob".
Expected result:
{
"id": 1,
"type": "dad",
"_childDocuments_": [
{
"id": 2,
"name": "Alice"
}
]
}
For this, I'm using the following query:
q: name:Alice
fl: *, [child parentFilter=*:* limit=10]
The problem is: this filter returns only the Alice child document, without the corresponding dad parent document.
How can I fix this search? I've tried using parentFilter=type:dad
, like suggested here, but this query throws an error that I couldn't understand:
Parent query must not match any docs besides parent filter. Combine them as must (+) and must-not (-) clauses to find a problem doc. docID=0
Also, if I filter with:
q: type:dad name:Alice
fl: *, [child parentFilter=*:* limit=10]
I will get two documents: dad + Alice and not one document with dad->Alice