Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id AB87E200BE0 for ; Sat, 3 Dec 2016 01:11:00 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id AA17B160B27; Sat, 3 Dec 2016 00:11:00 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id CB8A5160B24 for ; Sat, 3 Dec 2016 01:10:59 +0100 (CET) Received: (qmail 24620 invoked by uid 500); 3 Dec 2016 00:10:58 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Received: (qmail 24601 invoked by uid 99); 3 Dec 2016 00:10:58 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 03 Dec 2016 00:10:58 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 67AF22C1F54 for ; Sat, 3 Dec 2016 00:10:58 +0000 (UTC) Date: Sat, 3 Dec 2016 00:10:58 +0000 (UTC) From: "Judith Silverman (JIRA)" To: dev@lucene.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (SOLR-6203) cast exception while searching with sort function and result grouping MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Sat, 03 Dec 2016 00:11:00 -0000 [ https://issues.apache.org/jira/browse/SOLR-6203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15716678#comment-15716678 ] Judith Silverman edited comment on SOLR-6203 at 12/3/16 12:09 AM: ------------------------------------------------------------------ Hi, yes, that does indeed make sense, not that I have a clear idea of what "weighting of sort" does. And on that topic: I've had more time this week to work on this jira than I will have in the foreseeable future, so I'm forging ahead rather than sensibly waiting for your comments. I started calling new utility functions that make use of SortSpec's SchemaFields, but my updated unit tests kept failing with the same old "java.lang.Double cannot be cast to org.apache.lucene.util.BytesRef" error, and I got to wondering about the call to schema.getFileOrNull() in the new implWeightSortSpec() function from the SOLR-9660 patch. That function allows the dynamic '*' field to lay claim to schema fields which SortSpecParsing carefully protected from it, just as it does when called by the XXXResultTransformer functions we are gearing up to modify. I have only the vaguest understanding of what the weightSort()/rewrite()/createWeight() functions are all about. Do they actually affect which SchemaField a SortField should be associated to? I tweaked implWeightSortSpec() to leave SchemaFields alone except in the case that nullEquivalent kicks in, and all unit tests (including new ones testing the use of the new utility functions) now pass. For now, I'm posting a patch to our branch containing just the tweak to implWSS() and a little cleanup (removing my questions and your replies). Have a good weekend yourself! Thanks, Judith was (Author: judith): Hi, yes, that does indeed make sense, not that I have a clear idea of what "weighting of sort" does. And on that topic: I've had more time this week to work on this jira than I will have in the foreseeable future, so I'm forging ahead rather than sensibly waiting for your comments. I started calling new utility functions that make use of SortSpec's SchemaFields, but my updated unit tests kept failing with the same old "java.lang.Double cannot be cast to org.apache.lucene.util.BytesRef" error, and I got to wondering about the call to schema.getFileOrNull() in the new implWeightSortSpec() function from the SOLR-9660 patch. It seems to me to be allowing the dynamic '*' field to lay claim to schema fields which SortSpecParsing carefully protected from it. I have only the vaguest understanding of what weightSort()/rewrite()/ createWeight() functions are all about. Do they actually affect which SchemaField a SortField should be associated to? I tweaked implWeightSortSpec() to leave SchemaFields alone except in the case that nullEquivalent kicks in, and all tests now pass. I'll post a patch to our branch containing just that change and a little cleanup (removing my questions and your replies). Have a good weekend yourself! Thanks, Judith > 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, SOLR-6203.patch, SOLR-6203.patch, SOLR-6203.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} > > {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-unsubscribe@lucene.apache.org For additional commands, e-mail: dev-help@lucene.apache.org