title: Sphinx and query for ranked results by first AND and then combinations of OR
body: <p>I thought it is rather common case, but just can't figure out and find any info about it.</p>
  
  <p>Say I have following texts:</p>
  
  <ul>
  <li>Dogs hate cats</li>
  <li>My cat eat mice but hate dogs</li>
  <li>Mice hate cats but don't care about dogs</li>
  <li>Giraffes don't care about any cat</li>
  <li>Dogs are brave in most cases</li>
  </ul>
  
  <p>I can't figure out query, which returns texts in following order:</p>
  
  <p>1) First all texts which contains ALL three 'dog', 'cat' and 'mice', </p>
  
  <p>2) Then all texts which contains each pair of ('dog', 'cat'), ('dog', 'mice'), ('cat', 'mice') in no particular order</p>
  
  <p>3) Then all texts which contains any of 'dog', 'cat' or 'mice'</p>
  
  <p>So result of such query for given texts should be something like this (preferably shorter text first, but not necessarily)</p>
  
  <ul>
  <li>My cat eat mice but hate dogs</li>
  <li>Mice hate cats but don't care about dogs</li>
  <li>Dogs hate cats</li>
  <li>Giraffes don't care about any cat</li>
  <li>Dogs are brave in most cases</li>
  </ul>
  
  <p>Could anybody help me please?</p>