title: Sorting solr search results using multiple fields (solrj)
body: <p>I need to sort the results I get back from apache solr based on two factors:  </p>
  
  <p>There are three entities in our system that are indexed by solr (groups, projects and datasets) and in the results I want datasets to be displayed first, followed by projects and then groups; but I still want it to respect to score values for each of the types.  </p>
  
  <p>So, for example: results would be  </p>
  
  <ol>
  <li>Dataset with score of 0.325 </li>
  <li>Dataset with score of 0.282</li>
  <li>Dataset with score of 0.200</li>
  <li>Project with score of 0.298</li>
  <li>Project with score of 0.186</li>
  <li>Group with score of 0.360</li>
  <li>Group with score of 0.270</li>
  </ol>
  
  <p>I'm doing this in <strong>java</strong> and using <strong>solrj</strong> to construct the solr queries. The problem is that when I try to add 2 sort fields to the SolrQuery object it only seems to use one of them. Also in the solr documents there isn't anything to state the entity type but the document's ID is prefixed with the entity name so I was planning to use that.  </p>
  
  <p><strong>If anyone has got any ideas on how I could achieve this it would be greatly appreciated as I've been stuck on this for a while now!</strong></p>
  
  <p>Thanks in advance,
  -Jake.</p>