Skimming, I don't think this is inconsistent. First I assume that you're OK with the second example, it's this one seems odd to you:
sort=score asc group.sort=score desc You're telling Solr to return the highest scoring doc in each group. However, you're asking to order the _groups_ in ascending score order (i.e. the group with the lowest scoring doc first) of _any_ doc in that group, not just the one(s) returned. These are two separate things. "groupValue":"63", "doclist":{"numFound":143, My bet is that the 143rd doc's score in this group has a lower score than any document returned in any group. To verify: Specify: sort=score asc group.sort=score asc My bet: The ordering of the groups will be the same as sort=score asc group.sort=score desc It's just that the doc returned will be the lowest scoring doc. Best, Erick On Tue, Apr 11, 2017 at 8:16 AM, Eric Cartman <xdreuc...@gmail.com> wrote: > I modified and cleaned the previous query. As you can see the first query > sorting is a bit odd. > > Using parameters > sort=score asc > group.sort=score desc > > http://localhost:8983/solr/mcontent.ph_post/select?=&fl=*,score&group.field=partnerId&group.limit=1&group.main=false&group.ngroups=true&group.sort=score > desc&group=true&indent=on&q=text:cars&rows=5000&sort=score > asc&start=0&wt=json&omitHeader=true > > { > "grouped":{ > "partnerId":{ > "matches":8681, > "ngroups":10, > "groups":[{ > "groupValue":"63", > "doclist":{"numFound":143,"start":0,"maxScore":0.48749906,"docs":[ > { > "postId":"26317", > "score":0.48749906}] > }}, > { > "groupValue":"64", > "doclist":{"numFound":144,"start":0,"maxScore":0.34190965,"docs":[ > { > "postId":"25549", > "score":0.34190965}] > }}, > { > "groupValue":"28", > "doclist":{"numFound":2023,"start":0,"maxScore":0.6838193,"docs":[ > { > "postId":"31447", > "score":0.6838193}] > }}, > { > "groupValue":"23", > "doclist":{"numFound":3539,"start":0,"maxScore":0.6223264,"docs":[ > { > "postId":"15053", > "score":0.6223264}] > }}, > { > "groupValue":"25", > "doclist":{"numFound":2651,"start":0,"maxScore":0.9381923,"docs":[ > { > "postId":"21199", > "score":0.9381923}] > }}, > { > "groupValue":"61", > "doclist":{"numFound":160,"start":0,"maxScore":0.66007686,"docs":[ > { > "postId":"8730", > "score":0.66007686}] > }}, > { > "groupValue":"141", > "doclist":{"numFound":9,"start":0,"maxScore":0.5074051,"docs":[ > { > "postId":"34406", > "score":0.5074051}] > }}, > { > "groupValue":"142", > "doclist":{"numFound":9,"start":0,"maxScore":0.22002561,"docs":[ > { > "postId":"35000", > "score":0.22002561}] > }}, > { > "groupValue":"189", > "doclist":{"numFound":1,"start":0,"maxScore":0.09951033,"docs":[ > { > "postId":"33971", > "score":0.09951033}] > }}, > { > "groupValue":"40", > "doclist":{"numFound":2,"start":0,"maxScore":0.3283673,"docs":[ > { > "postId":"30142", > "score":0.3283673}] > }}]}}} > > Using parameters > sort=score desc > group.sort=score desc > > http://localhost:8983/solr/mcontent.ph_post/select?=&fl=*,score&group.field=partnerId&group.limit=1&group.main=false&group.ngroups=true&group.sort=score > desc&group=true&indent=on&q=text:cars&rows=5000&sort=score > desc&start=0&wt=json&omitHeader=true > { > "grouped":{ > "partnerId":{ > "matches":8681, > "ngroups":10, > "groups":[{ > "groupValue":"25", > "doclist":{"numFound":2651,"start":0,"maxScore":0.9381923,"docs":[ > { > "postId":"21199", > "score":0.9381923}] > }}, > { > "groupValue":"28", > "doclist":{"numFound":2023,"start":0,"maxScore":0.6838193,"docs":[ > { > "postId":"31447", > "score":0.6838193}] > }}, > { > "groupValue":"61", > "doclist":{"numFound":160,"start":0,"maxScore":0.66007686,"docs":[ > { > "postId":"8730", > "score":0.66007686}] > }}, > { > "groupValue":"23", > "doclist":{"numFound":3539,"start":0,"maxScore":0.6223264,"docs":[ > { > "postId":"15053", > "score":0.6223264}] > }}, > { > "groupValue":"141", > "doclist":{"numFound":9,"start":0,"maxScore":0.5074051,"docs":[ > { > "postId":"34406", > "score":0.5074051}] > }}, > { > "groupValue":"63", > "doclist":{"numFound":143,"start":0,"maxScore":0.48749906,"docs":[ > { > "postId":"26317", > "score":0.48749906}] > }}, > { > "groupValue":"64", > "doclist":{"numFound":144,"start":0,"maxScore":0.34190965,"docs":[ > { > "postId":"25549", > "score":0.34190965}] > }}, > { > "groupValue":"40", > "doclist":{"numFound":2,"start":0,"maxScore":0.3283673,"docs":[ > { > "postId":"30142", > "score":0.3283673}] > }}, > { > "groupValue":"142", > "doclist":{"numFound":9,"start":0,"maxScore":0.22002561,"docs":[ > { > "postId":"35000", > "score":0.22002561}] > }}, > { > "groupValue":"189", > "doclist":{"numFound":1,"start":0,"maxScore":0.09951033,"docs":[ > { > "postId":"33971", > "score":0.09951033}] > }}]}}} > > > On Tue, Apr 11, 2017 at 10:17 PM, Erick Erickson <erickerick...@gmail.com> > wrote: > >> the group.sort spec is specified twice in the URL >> >> group.sort=score desc& >> group.sort=score desc >> >> Is there a chance that during testing you only changed _one_ of them so >> you had >> >> group.sort=score desc& >> group.sort=score asc >> >> ? I think the last one should win.. Shot in the dark. >> >> Best, >> Erick >> >> On Tue, Apr 11, 2017 at 3:23 AM, alessandro.benedetti >> <a.benede...@sease.io> wrote: >> > To be fair the second result seems consistent with the Solr grouping >> logic : >> > >> > *First Query results (Suspicious)* >> > 1) group.sort= score desc -> select the group head as you have 1 doc per >> > group( the head will be the top scoring doc per group) >> > 2) sort=score asc -> sort the groups by the score of the head ascending >> ( so >> > the final resulting groups should be ascending in score) >> > >> > >> > *Second Query results ( CORRECT)* >> > 1) group.sort= score desc -> select the group head as you have 1 doc per >> > group( the head will be the top scoring doc per group) >> > 2) sort -> sort the groups by the score of the head ( so the final >> resulting >> > groups are sorted descending) >> > >> > Are we sure the the sort is expected to sort the groups after the >> grouping >> > happened ? >> > I need to check the internals but I agree the current behaviour is not >> > intuitive. >> > >> > Cheers >> > >> > >> > >> > >> > >> > ----- >> > --------------- >> > Alessandro Benedetti >> > Search Consultant, R&D Software Engineer, Director >> > Sease Ltd. - www.sease.io >> > -- >> > View this message in context: http://lucene.472066.n3. >> nabble.com/Grouped-Result-sort-issue-tp4329255p4329292.html >> > Sent from the Solr - User mailing list archive at Nabble.com. >>