Currently, solr grouping (http://wiki.apache.org/solr/FieldCollapsing) sorts
groups "by the score of the top document within each group". E.g. 
[...] 
"groups":[{ 
    "groupValue":"81cb63020d0339adb019a924b2a9e0c2", 
    "doclist":{"numFound":9,"start":0,"maxScore":4.729042,"docs":[ 
        { 
          "id":"7481df771afe39fab368ce19dfeeb528", 
          [...], 
          "score":4.729042}, 
        { 
          "id":"c879e95b5f16343dad8b1248133727c2", 
          [...], 
          "score":4.6635237}, 
        { 
          "id":"485b9aec90fd3ef381f013c51ab6a4df", 
          [...], 
          "score":4.347174}] 
    }}, 
[...] 
Is there an out-of-the-box way to sort groups by the sum of the scores of
the documents within each group? E.g. 
[...] 
"groups":[{ 
    "groupValue":"81cb63020d0339adb019a924b2a9e0c2", 
    "doclist":{"numFound":9,"start":0,"scoreSum":13.739738,"docs":[ 
        { 
          "id":"7481df771afe39fab368ce19dfeeb528", 
          [...], 
          "score":4.729042}, 
        { 
          "id":"c879e95b5f16343dad8b1248133727c2", 
          [...], 
          "score":4.6635237}, 
        { 
          "id":"485b9aec90fd3ef381f013c51ab6a4df", 
          [...], 
          "score":4.347174}] 
    }}, 
[...] 
With the release of sorting by Function Query
(https://issues.apache.org/jira/browse/SOLR-1297), it seems that there
should be a way to use the sum() function
(http://wiki.apache.org/solr/FunctionQuery). But it's not quite close enough
since the "score" field is not part of the documents. 

I feel like I'm close but I'm missing some obvious piece. I'm using Solr
4.6.



--
View this message in context: 
http://lucene.472066.n3.nabble.com/sort-groups-by-the-sum-of-the-scores-of-the-documents-within-each-group-tp4134607.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to