[ 
https://issues.apache.org/jira/browse/SOLR-6203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15585894#comment-15585894
 ] 

Christine Poerschke commented on SOLR-6203:
-------------------------------------------

Hello [~nated] and [~Judith],

Thanks for reporting this issue in detail and attaching test case and code 
change patches.

I started looking at this last week but only now got around to writing comments 
here, apologies for the delay.

* The original SOLR-6203-unittest.patch still applies cleanly but running
{code}
cd solr/core
ant test -Dtestcase=DistributedQueryComponentCustomSortTest
{code}
gives
{code}
... unexpected docvalues type SORTED_SET for field 'text' (expected=SORTED). 
Re-index with correct docvalues type. ...
{code}
error. I have not looked into the details for that error but simply changing
{code}
- ... "group.field", "text" ...
+ ... "group.field", "id" ...
{code}
in the test patch again produces the {{java.lang.Double cannot be cast to 
org.apache.lucene.util.BytesRef}} exception.

* The original SOLR-6203.patch could no longer be applied cleanly, that is of 
course nothing to worry about though since the patch is over a year old by now.
** I have separated out some parts of the patch into the micro commits above 
and into the linked SOLR-9627 patch.
** Trying to graft everything from your patch onto the current master branch 
seemed to work at first but then tests were failing and so i backtracked, to 
what your README mentions as the first step i.e. storing SortSpecs rather than 
Sorts in GroupingSpecification. There was also the
bq. TODO eliminate GroupingSpec's (Group)Offset and (Group)Limit fields and get 
those values from its SortSpecs.
comment in your patch and i pulled that into scope for the SOLR-9660 sub-step 
because i think it will make the subsequent code changes here easier.
*** The tests for the SOLR-9660 sub-step are still failing, extra pairs of eyes 
and reviews of the patch are very welcome. The SOLR-9649 discovery is also 
unexpected and perhaps figuring out the latter will help with fixing the former.

> cast exception while searching with sort function and result grouping
> ---------------------------------------------------------------------
>
>                 Key: SOLR-6203
>                 URL: https://issues.apache.org/jira/browse/SOLR-6203
>             Project: Solr
>          Issue Type: Bug
>          Components: search
>    Affects Versions: 4.7, 4.8
>            Reporter: Nate Dire
>            Assignee: Christine Poerschke
>         Attachments: README, SOLR-6203-unittest.patch, 
> SOLR-6203-unittest.patch, SOLR-6203.patch
>
>
> After upgrading from 4.5.1 to 4.7+, a schema including a {{"*"}} dynamic 
> field as text gets a cast exception when using a sort function and result 
> grouping.  
> Repro (with example config):
> # Add {{"*"}} dynamic field as a {{TextField}}, eg:
> {noformat}
> <dynamicField name="*" type="text_general" multiValued="true" />
> {noformat}
> #  Create  sharded collection
> {noformat}
> curl 
> 'http://localhost:8983/solr/admin/collections?action=CREATE&name=test&numShards=2&maxShardsPerNode=2'
> {noformat}
> # Add example docs (query must have some results)
> # Submit query which sorts on a function result and uses result grouping:
> {noformat}
> {
>   "responseHeader": {
>     "status": 500,
>     "QTime": 50,
>     "params": {
>       "sort": "sqrt(popularity) desc",
>       "indent": "true",
>       "q": "*:*",
>       "_": "1403709010008",
>       "group.field": "manu",
>       "group": "true",
>       "wt": "json"
>     }
>   },
>   "error": {
>     "msg": "java.lang.Double cannot be cast to 
> org.apache.lucene.util.BytesRef",
>     "code": 500
>   }
> }
> {noformat}
> Source exception from log:
> {noformat}
> ERROR - 2014-06-25 08:10:10.055; org.apache.solr.common.SolrException; 
> 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)
>     at 
> org.apache.solr.handler.component.QueryComponent.process(QueryComponent.java:340)
>     at 
> org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:218)
>     at 
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
>   ...
> {noformat}
> It looks like {{serializeSearchGroup}} is matching the sort expression as the 
> {{"*"}} dynamic field, which is a TextField in the repro.



--
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

Reply via email to