I need to sort the results I get back from apache solr based on two factors:
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.
So, for example: results would be
- Dataset with score of 0.325
- Dataset with score of 0.282
- Dataset with score of 0.200
- Project with score of 0.298
- Project with score of 0.186
- Group with score of 0.360
- Group with score of 0.270
I'm doing this in java and using solrj 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.
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!
Thanks in advance, -Jake.