[ https://issues.apache.org/jira/browse/SOLR-9970?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Oleg Demkovych updated SOLR-9970: --------------------------------- Description: Solr sorting with group.sort and sort returns inappropriate order. Documents example: {code} [ { "index": 1, "key": "key1", "rank": 1 }, { "index": 1, "key": "key1", "rank": 3 }, { "index": 1, "key": "key2", "rank": 2 }, { "index": 1, "key": "key3", "rank": 1 }, { "index": 2, "key": "key3", "rank": 3 }, { "index": 3, "key": "key3", "rank": 1 } ] {code} *Steps to reproduce:* Execute query: *q=\*:\*&group=true&group.field=key&group.sort=index asc&sort=rank desc* *Expected result:* {code} "groups": [ { "groupValue": "key2", "doclist": { "numFound": 1, "start": 0, "docs": [ { "index": 1, "key": "key2", "rank": 2 } ] } }, { "groupValue": "key3", "doclist": { "numFound": 3, "start": 0, "docs": [ { "index": 1, "key": "key3", "rank": 1 } ] } }, { "groupValue": "key1", "doclist": { "numFound": 2, "start": 0, "docs": [ { "index": 1, "key": "key1", "rank": 1 } ] } } ] {code} *Actual result:* {code} "groups": [ { "groupValue": "key1", "doclist": { "numFound": 2, "start": 0, "docs": [ { "index": 1, "key": "key1", "rank": 1 } ] } }, { "groupValue": "key3", "doclist": { "numFound": 3, "start": 0, "docs": [ { "index": 1, "key": "key3", "rank": 1 } ] } }, { "groupValue": "key2", "doclist": { "numFound": 1, "start": 0, "docs": [ { "index": 1, "key": "key2", "rank": 2 } ] } } ] {code} Groups should be ordered based on first document in group after group.sort was applied. was: Solr sorting with group.sort and sort returns inappropriate order. Documents example: {code} [ { "index": 1, "key": "key1", "rank": 1 }, { "index": 1, "key": "key1", "rank": 3 }, { "index": 1, "key": "key2", "rank": 2 }, { "index": 1, "key": "key3", "rank": 1 }, { "index": 2, "key": "key3", "rank": 3 }, { "index": 3, "key": "key3", "rank": 1 } ] {code} *Steps to reproduce:* Execute query: *q=*:*&group=true&group.field=key&group.sort=index asc&sort=rank desc* *Expected result:* {code} "groups": [ { "groupValue": "key2", "doclist": { "numFound": 1, "start": 0, "docs": [ { "index": 1, "key": "key2", "rank": 2 } ] } }, { "groupValue": "key3", "doclist": { "numFound": 3, "start": 0, "docs": [ { "index": 1, "key": "key3", "rank": 1 } ] } }, { "groupValue": "key1", "doclist": { "numFound": 2, "start": 0, "docs": [ { "index": 1, "key": "key1", "rank": 1 } ] } } ] {code} *Actual result:* {code} "groups": [ { "groupValue": "key1", "doclist": { "numFound": 2, "start": 0, "docs": [ { "index": 1, "key": "key1", "rank": 1 } ] } }, { "groupValue": "key3", "doclist": { "numFound": 3, "start": 0, "docs": [ { "index": 1, "key": "key3", "rank": 1 } ] } }, { "groupValue": "key2", "doclist": { "numFound": 1, "start": 0, "docs": [ { "index": 1, "key": "key2", "rank": 2 } ] } } ] {code} Groups should be ordered based on first document in group after group.sort was applied. > Wrong groups order with sort and group.sort > ------------------------------------------- > > Key: SOLR-9970 > URL: https://issues.apache.org/jira/browse/SOLR-9970 > Project: Solr > Issue Type: Bug > Security Level: Public(Default Security Level. Issues are Public) > Components: search > Affects Versions: 6.2.1, 6.3 > Reporter: Oleg Demkovych > > Solr sorting with group.sort and sort returns inappropriate order. > Documents example: > {code} > [ > { > "index": 1, > "key": "key1", > "rank": 1 > }, > { > "index": 1, > "key": "key1", > "rank": 3 > }, > { > "index": 1, > "key": "key2", > "rank": 2 > }, > { > "index": 1, > "key": "key3", > "rank": 1 > }, > { > "index": 2, > "key": "key3", > "rank": 3 > }, > { > "index": 3, > "key": "key3", > "rank": 1 > } > ] > {code} > *Steps to reproduce:* > Execute query: *q=\*:\*&group=true&group.field=key&group.sort=index > asc&sort=rank desc* > *Expected result:* > {code} > "groups": [ > { > "groupValue": "key2", > "doclist": { > "numFound": 1, > "start": 0, > "docs": [ > { > "index": 1, > "key": "key2", > "rank": 2 > } > ] > } > }, > { > "groupValue": "key3", > "doclist": { > "numFound": 3, > "start": 0, > "docs": [ > { > "index": 1, > "key": "key3", > "rank": 1 > } > ] > } > }, > { > "groupValue": "key1", > "doclist": { > "numFound": 2, > "start": 0, > "docs": [ > { > "index": 1, > "key": "key1", > "rank": 1 > } > ] > } > } > ] > {code} > *Actual result:* > {code} > "groups": [ > { > "groupValue": "key1", > "doclist": { > "numFound": 2, > "start": 0, > "docs": [ > { > "index": 1, > "key": "key1", > "rank": 1 > } > ] > } > }, > { > "groupValue": "key3", > "doclist": { > "numFound": 3, > "start": 0, > "docs": [ > { > "index": 1, > "key": "key3", > "rank": 1 > } > ] > } > }, > { > "groupValue": "key2", > "doclist": { > "numFound": 1, > "start": 0, > "docs": [ > { > "index": 1, > "key": "key2", > "rank": 2 > } > ] > } > } > ] > {code} > Groups should be ordered based on first document in group after group.sort > was applied. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org