[ https://issues.apache.org/jira/browse/SOLR-424?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12565561#action_12565561 ]
yourabi edited comment on SOLR-424 at 2/4/08 2:03 PM: ------------------------------------------------------------ Since all response writers implement the TextResponseWriter abstract class it seems like it might make more sense to tweak writeVal (line 115) from: if (val==null) to: if (val==null || val.toString().length() == 0 || "".equals(val.toString())) { As Yonik has pointed out -- this is just part of the problem, the other being how did it get to be empty in the first place. Perhaps breaking this up into two separate issues makes more sense? Attaching (trivial) patch to TextResponseWriter. Feedback please. Thanks, Yousef was (Author: yourabi): Since all response writers implement the TextResponseWriter abstract class it seems like it might make more sense to tweak writeVal (line 115) to: if (val==null) from: if (val==null || val.toString().length() == 0 || "".equals(val.toString())) { As Yonik has pointed out -- this is just part of the problem, the other being how did it get to be empty in the first place. Perhaps breaking this up into two separate issues makes more sense? Attaching (trivial) patch to TextResponseWriter. Feedback please. Thanks, Yousef > The ruby output type produces incorrect output for numeric types without a > value > -------------------------------------------------------------------------------- > > Key: SOLR-424 > URL: https://issues.apache.org/jira/browse/SOLR-424 > Project: Solr > Issue Type: Bug > Components: clients - ruby - flare > Affects Versions: 1.1.0, 1.2, 1.3 > Reporter: Kurt Schrader > Priority: Critical > Fix For: 1.3 > > Attachments: fix_ruby_output.patch, > TextResponseWriter-SOLR-424.patch, zero_length_int.patch > > > When parsing the Ruby output returned from Solr, if a numerical value has no > value in the index, it causes an invalid Ruby hash to be returned. For > instance: > {code:xml} > 'response'=>{'numFound'=>1,'start'=>0,'maxScore'=>4.951244,'docs'=>[ > { > 'subclass_t'=>'Protocol', > 'pk_i'=>1, > 'id'=>'Protocol:1', > 'name_t'=>'Falcipain IC50', > 'group_id_i'=>, > 'score'=>4.951244}] > }} > {code} > is not a valid hash because 'group_id_i' does not resolve to anything. It > should resolve to nil: > {code:xml} > 'response'=>{'numFound'=>1,'start'=>0,'maxScore'=>4.951244,'docs'=>[ > { > 'subclass_t'=>'Protocol', > 'pk_i'=>1, > 'id'=>'Protocol:1', > 'name_t'=>'Falcipain IC50', > 'group_id_i'=>nil, > 'score'=>4.951244}] > }} > {code} -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.