I have a solr core which has a mix of child-free and with-child documents,
sample xml:
<add>
<doc>
<field name="id">4</field>
<field name="title">Regular Shirt</field>
<field name="doc_type">Parent</field>
<field name="color">Black</field>
</doc>
<doc>
<field name="id">8</field>
<field name="title">Solid Rug</field>
<field name="doc_type">Parent</field>
<field name="pattern">Solid</field>
</doc>
<doc>
<field name="id">1</field>
<field name="title">Regular color Shirts</field>
<field name="doc_type">Parent</field>
<field name="items">
<doc>
<field name="id">2</field>
<field name="doc_type">Child</field>
<field name="pcs_color">Red</field>>
</doc>
<doc>
<field name="id">3</field>
<field name="doc_type">Child</field>
<field name="color">Blue</field>>
</doc>
</field>
</doc>
<doc>
<field name="id">5</field>
<field name="title">Rugs</field>
<field name="doc_type">Parent</field>
<field name="items">
<doc>
<field name="id">6</field>
<field name="doc_type">Child</field>
<field name="pattern">Abstract</field>
</doc>
<doc>
<field name="id">7</field>
<field name="doc_type">Child</field>
<field name="pattern">Printed</field>
</doc>
</field>
</doc>
</add>
Now i want to write a query which fetched all items [with child and without
child] with color:red, title having shirt
Here is my query:
/solr/test/select?q={!parent%20which=doc_type:Parent%20score=max}%20%20{!boost%20b=100.0%20}pcs_color:Red%20{!dismax%20qf=title%20v=%27Regular%27%20score=total}&fl=id,product_class_type,title,score,pcs_color&wt=json
<http://localhost:8983/solr/test/select?q={!parent%20which=doc_type:Parent%20score=max}%20%20{!boost%20b=100.0%20}pcs_color:Red%20{!dismax%20qf=title%20v=%27Regular%27%20score=total}&fl=id,product_class_type,title,score,pcs_color&wt=json>

Error:
"msg": "Child query must not match same docs with parent filter. Combine
them as must clauses (+) to find a problem doc. docId=4, class
org.apache.lucene.search.DisjunctionSumScorer",
I think docId 4 is matching with query but as this is a parent solr is
throwing error.

How to proceed here?

Reply via email to