title: Solr - how to get children of parent documents where parents are filtered by multiple criteria?
body: <p>I have in solr documents that resemble the following structure:</p>
  <pre><code>[
      {
          &quot;id&quot;: &quot;stationId-37246&quot;,
          &quot;type&quot;: &quot;station&quot;,
          &quot;territory&quot;: &quot;372&quot;,
          &quot;genres&quot;:
          {
              &quot;id&quot;: &quot;genreId-37246-a4nm24kgsadvmdv4cgemt-20-372-ga&quot;,
              &quot;type&quot;: &quot;genre&quot;,
              &quot;genre_type&quot;: &quot;station&quot;,
              &quot;genre_href&quot;: &quot;3.1.1.11&quot;,
              &quot;_nest_path_&quot;: &quot;/genres#&quot;
          }
      },
      {
          &quot;id&quot;: &quot;stationId-3724&quot;,
          &quot;territory&quot;: &quot;372&quot;,
          &quot;type&quot;: &quot;station&quot;,
          &quot;genres&quot;:
          {
              &quot;id&quot;: &quot;genreId-3724-ep7tvwiiekl9ud8vewhjb-3-372-ga&quot;,
              &quot;type&quot;: &quot;genre&quot;,
              &quot;genre_type&quot;: &quot;station&quot;,
              &quot;genre_href&quot;: &quot;3.1.1&quot;,
              &quot;_nest_path_&quot;: &quot;/genres#&quot;
          }
      },
      {
          &quot;id&quot;: &quot;stationId-37245&quot;,
          &quot;territory&quot;: &quot;372&quot;,
          &quot;type&quot;: &quot;station&quot;,
          &quot;genres&quot;:
          {
              &quot;id&quot;: &quot;genreId-37245-4osajn644rg7p3jd8jqu8m-20-372-ga&quot;,
              &quot;type&quot;: &quot;genre&quot;,
              &quot;genre_type&quot;: &quot;station&quot;,
              &quot;genre_href&quot;: &quot;3.1.1.11&quot;,
              &quot;_nest_path_&quot;: &quot;/genres#&quot;
          }
      },
      {
          &quot;id&quot;: &quot;odId-37248&quot;,
          &quot;territory&quot;: &quot;372&quot;,
          &quot;type&quot;: &quot;ondemand&quot;,
          &quot;genres&quot;:
          {
              &quot;id&quot;: &quot;genreId-37248-y1wljbe9uus1m25yqie23s-122-372-ga&quot;,
              &quot;type&quot;: &quot;genre&quot;,
              &quot;genre_type&quot;: &quot;ondemand&quot;,
              &quot;genre_href&quot;: &quot;3.1.5.2&quot;,
              &quot;_nest_path_&quot;: &quot;/genres#&quot;
          }
      },
      {
          &quot;id&quot;: &quot;stationId-44449&quot;,
          &quot;territory&quot;: &quot;444&quot;,
          &quot;type&quot;: &quot;station&quot;,
          &quot;genres&quot;:
          {
              &quot;id&quot;: &quot;genreId-44449-y1wljbe9uus1m25yqie23s-122-372-ga&quot;,
              &quot;type&quot;: &quot;genre&quot;,
              &quot;genre_type&quot;: &quot;station&quot;,
              &quot;genre_href&quot;: &quot;3.1.5.4&quot;,
              &quot;_nest_path_&quot;: &quot;/genres#&quot;
          }
      }
  ]
  </code></pre>
  <p>I need to be able to give a list of genres, for a particular territory and for a particular genre type.</p>
  <p>For example I want to be able to get the list of genres, that are attached to parents that are in territory 372, and have the genre_type:station.</p>
  <p>The above example should produce something like:</p>
  <pre><code>[
      {
          &quot;id&quot;: &quot;genreId-37246-a4nm24kgsadvmdv4cgemt-20-372-ga&quot;,
          &quot;type&quot;: &quot;genre&quot;,
          &quot;genre_type&quot;: &quot;station&quot;,
          &quot;genre_href&quot;: &quot;3.1.1.11&quot;,
          &quot;_nest_path_&quot;: &quot;/genres#&quot;
      },
      {
          &quot;id&quot;: &quot;genreId-37245-4osajn644rg7p3jd8jqu8m-20-372-ga&quot;,
          &quot;type&quot;: &quot;genre&quot;,
          &quot;genre_type&quot;: &quot;station&quot;,
          &quot;genre_href&quot;: &quot;3.1.1.11&quot;,
          &quot;_nest_path_&quot;: &quot;/genres#&quot;
      },
      {
          &quot;id&quot;: &quot;genreId-3724-ep7tvwiiekl9ud8vewhjb-3-372-ga&quot;,
          &quot;type&quot;: &quot;genre&quot;,
          &quot;genre_type&quot;: &quot;station&quot;,
          &quot;genre_href&quot;: &quot;3.1.1&quot;,
          &quot;_nest_path_&quot;: &quot;/genres#&quot;
      }
  ]
  
  </code></pre>
  <p>But if I'd want the same type of genres, for territory 444 I'd get</p>
  <pre><code>{
      &quot;id&quot;: &quot;genreId-44449-y1wljbe9uus1m25yqie23s-122-372-ga&quot;,
      &quot;type&quot;: &quot;genre&quot;,
      &quot;genre_type&quot;: &quot;station&quot;,
      &quot;genre_href&quot;: &quot;3.1.5.4&quot;,
      &quot;_nest_path_&quot;: &quot;/genres#&quot;
  }
  </code></pre>
  <p>Any suggestions? I'm trying to do all kinds of voodoo, but I find the solr documentation site a bit difficult to comprehend. :\</p>
  <p>So this returns correctly:</p>
  <pre><code>&quot;params&quot;:
          {
              &quot;q&quot;: &quot;{!child of=\&quot;+type: station\&quot;}territory:372&quot;,
              &quot;fq&quot;:
              [
                  &quot;genre_type: station&quot;,
                  &quot;type: genre&quot;
              ],
          }
  </code></pre>
  <p>but this one throws the same error as below:</p>
  <pre><code>&quot;params&quot;:
          {
              &quot;q&quot;: &quot;{!child of=\&quot;+type: ondemand\&quot;}territory:372&quot;,
              &quot;fq&quot;:
              [
                  &quot;genre_type: ondemand&quot;,
                  &quot;type: genre&quot;
              ],
          }
  </code></pre>
  <pre><code>Parent query must not match any docs besides parent filter. Combine them as must (+) and must-not (-) clauses to find a problem doc. docID=50924
  </code></pre>