title: How to query Solr for child documents
body: <p>I'm trying to run a block join query to pull child documents but I'm getting a "Parent query yields document which is not matched by parents filter" error. <strong>I'm using Solr 5.5</strong></p>
  
  <p>My schema looks like this:</p>
  
  <pre><code>&lt;field name="url" type="string" indexed="true" stored="true" required="true" multiValued="false" /&gt;
  &lt;field name="name" type="text_en" indexed="true" stored="true" required="true" multiValued="false" /&gt;
  &lt;field name="content_type" type="string" indexed="true" stored="true" required="true" multiValued="false" /&gt;
  &lt;uniqueKey&gt;url&lt;/uniqueKey&gt;
  </code></pre>
  
  <p>Insert statement looks like this:</p>
  
  <pre><code>{
    "url": "http://www.test.com/index.html",
    "name": "parent product",
    "content_type": "parentDocument",
    "_childDocuments_": [
      {
        "url": "http://www.test.com/index2.html",
        "name": "child product",
        "content_type": "childDocument"
      },
      {
        "url": "http://www.test.com/index3.html",
        "name": "child product 2",
        "content_type": "childDocument"
      }
    ]
  }
  </code></pre>
  
  <p>Running a standard <code>*:*</code> query in the console pulls back the 3 documents and shows the children belong to their parent:</p>
  
  <pre><code>{
    "docs": [
      {
        "url": "http://www.test.com/index2.html",
        "name": "child product",
        "content_type": "childDocument",
        "_root_": "http://www.test.com/index.html"
      },
      {
        "url": "http://www.test.com/index3.html",
        "name": "child product 2",
        "content_type": "childDocument",
        "_root_": "http://www.test.com/index.html"
      },
      {
        "url": "http://www.test.com/index.html",
        "name": "test product",
        "content_type": "parentDocument",
        "_version_": 1541193313504198700,
        "_root_": "http://www.test.com/index.html"
      }
    ]
  }
  </code></pre>
  
  <p>However If I run <code>q={!child of="content_type:parentDocument"}</code> I get the parent document which I would not expect given the "child of" statement:</p>
  
  <pre><code>{
    "responseHeader": {
      "status": 0,
      "QTime": 0,
      "params": {
        "q": "{!child of=\"content_type:parentDocument\"}",
        "indent": "true",
        "wt": "json"
      }
    },
    "response": {
      "numFound": 1,
      "start": 0,
      "docs": [
        {
          "url": "http://www.test.com/index.html",
          "name": "test product",
          "content_type": "parentDocument",
          "_version_": 1541193313504198656,
          "_root_": "http://www.test.com/index.html"
        }
      ]
    }
  }
  </code></pre>
  
  <p>But if I add any sort of query I get an error e.g. </p>
  
  <pre><code>q={!child of="content_type:parentDocument"}name:product 
  </code></pre>
  
  <p>or even </p>
  
  <pre><code>q={!child of="content_type:parentDocument"}name:*
  </code></pre>
  
  <p>"Parent query yields document which is not matched by parents filter, docID=0"</p>