title: Any way to merge two queries in solr?
body: <p>In my project, we use solr to index a lot of different kind of documents, by example Books and Persons, with some common fields (like the name) and some type-specific fields (like the category, or the group people belong to).</p>
  
  <p>We would like to do queries that can find both books and persons, with for each document type some filters applied. Something like:</p>
  
  <ul>
  <li>find all Books and Persons with "Jean" in the name and/or content</li>
  <li>but only Books from category "fiction" and "fantasy"</li>
  <li>and only Persons from the group "pangolin"</li>
  <li>everything sorted by score</li>
  </ul>
  
  <p>A very simple way to do that would be:</p>
  
  <pre><code>q = name:jean content:jean
  &amp;
  fq= 
      (type:book AND category:(fiction fantasy)) 
      OR 
      (type:person AND group:pangolin)
  </code></pre>
  
  <p>But alas, as <code>fq</code> are cached, I'd prefer something allowing me simpler and so more reusable <code>fq</code> like :</p>
  
  <ul>
  <li><code>fq=type:book</code>,</li>
  <li><code>fq=type:person</code>, </li>
  <li><code>fq=category(fiction fantasy)</code>,</li>
  <li><code>fq=group:pangolin</code>.</li>
  </ul>
  
  <p>Is there a way to tell solr to merge or combine many queries? Something like 'grouping' <code>fq</code> together.</p>
  
  <p>I read a bit about nested queries with <code>_query_</code>, but the very few documentation about it makes me think it's not the solution I'm looking for.</p>