: I recently tried upgrading our setup from 4.5.1 to 4.7+, and I'm : seeing an exception when I use (1) a function to sort and (2) result : grouping. The same query works fine with either (1) or (2) alone. : Example below.
Did you modify your schema in any way when upgrading? Can you provide some sample data to demonstrates the problem? (ideally using the 4.x example configs - but if you can't reproduce with that then providing your own configs would be helpful) I was unabled to reproduce doing a quick sanity check using the example with a "shard" param to force a distrib query... http://localhost:8983/solr/select?q=*:*&shards=localhost:8983/solr&sort=sum%281,1%29%20desc&group=true&group.field=inStock It's possible that the distributed grouping code has a bug in it related to the marshalling of sort values and i'm just not tickling that bug with my quick check ... but if i remember correctly work was done to fix grouped sorting to correctly deal with this when FieldType.marshalSortValue was introduced. : Example (v4.8.1): : { : "responseHeader": { : "status": 500, : "QTime": 14, : "params": { : "sort": "sum(1,1) desc", : "indent": "true", : "q": "title:solr", : "_": "1403586036335", : "group.field": "type", : "group": "true", : "wt": "json" : } : }, : "error": { : "msg": "java.lang.Double cannot be cast to org.apache.lucene.util.BytesRef", : "trace": "org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: : java.lang.Double cannot be cast to org.apache.lucene.util.BytesRef : "code": 500 : } : } : : From the log: : : org.apache.solr.common.SolrException; : null:java.lang.ClassCastException: java.lang.Double cannot be cast to : org.apache.lucene.util.BytesRef : at org.apache.solr.schema.FieldType.marshalStringSortValue(FieldType.java:981) : at org.apache.solr.schema.TextField.marshalSortValue(TextField.java:176) : at org.apache.solr.search.grouping.distributed.shardresultserializer.SearchGroupsResultTransformer.serializeSearchGroup(SearchGroupsResultTransformer.java:125) : at org.apache.solr.search.grouping.distributed.shardresultserializer.SearchGroupsResultTransformer.transform(SearchGroupsResultTransformer.java:65) : at org.apache.solr.search.grouping.distributed.shardresultserializer.SearchGroupsResultTransformer.transform(SearchGroupsResultTransformer.java:43) : at org.apache.solr.search.grouping.CommandHandler.processResult(CommandHandler.java:193) -Hoss http://www.lucidworks.com/