You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by "Kurt Schrader (JIRA)" <ji...@apache.org> on 2007/11/29 03:25:43 UTC

[jira] Created: (SOLR-424) The ruby output type produces incorrect output for numeric types without a value

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


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.


[jira] Commented: (SOLR-424) The ruby output type produces incorrect output for numeric types without a value

Posted by "Erik Hatcher (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-424?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12549681 ] 

Erik Hatcher commented on SOLR-424:
-----------------------------------

I agree with Kurt - nil makes more sense than zero in this case.

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


[jira] Commented: (SOLR-424) The ruby output type produces incorrect output for numeric types without a value

Posted by "Otis Gospodnetic (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-424?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12558069#action_12558069 ] 

Otis Gospodnetic commented on SOLR-424:
---------------------------------------

For what it's worth, I've had 2 additional people say that returning the correct Ruby output would be better...


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


[jira] Updated: (SOLR-424) The ruby output type produces incorrect output for numeric types without a value

Posted by "Mike Klaas (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-424?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mike Klaas updated SOLR-424:
----------------------------


Eric or Yonik, do you want to mentor this for 1.3?

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


[jira] Updated: (SOLR-424) The ruby output type produces incorrect output for numeric types without a value

Posted by "Kurt Schrader (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-424?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kurt Schrader updated SOLR-424:
-------------------------------

    Attachment: fix_ruby_output.patch

Here is a patch for the issue.  The code seems to be untested, along with all of the other output types, so I couldn't find a test case to modify to cover this issue.

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


[jira] Updated: (SOLR-424) The ruby output type produces incorrect output for numeric types without a value

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-424?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yonik Seeley updated SOLR-424:
------------------------------

    Attachment: SOLR-424.patch

attaching patch that uses a "null" value for legacy int/long lucene fields only when a zero length string is encountered as the field value.

> 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
>            Assignee: Erik Hatcher
>            Priority: Critical
>             Fix For: 1.3
>
>         Attachments: fix_ruby_output.patch, SOLR-424.patch, TextResponseWriter-424.java.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.


[jira] Commented: (SOLR-424) The ruby output type produces incorrect output for numeric types without a value

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-424?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12604988#action_12604988 ] 

Yonik Seeley commented on SOLR-424:
-----------------------------------

The latest patch would have a non-negligible performance impact (since it calls toString() and trim() on every object)
and incorrect output (since it would effectively disable zero length strings for any type, including strings).

> 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
>            Assignee: Erik Hatcher
>            Priority: Critical
>             Fix For: 1.3
>
>         Attachments: fix_ruby_output.patch, TextResponseWriter-424.java.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.


[jira] Commented: (SOLR-424) The ruby output type produces incorrect output for numeric types without a value

Posted by "Yousef Ourabi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-424?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12565561#action_12565561 ] 

Yousef Ourabi commented on SOLR-424:
------------------------------------

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.


[jira] Resolved: (SOLR-424) The ruby output type produces incorrect output for numeric types without a value

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-424?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yonik Seeley resolved SOLR-424.
-------------------------------

    Resolution: Fixed

committed.

> 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
>            Assignee: Erik Hatcher
>            Priority: Critical
>             Fix For: 1.3
>
>         Attachments: fix_ruby_output.patch, SOLR-424.patch, TextResponseWriter-424.java.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.


[jira] Commented: (SOLR-424) The ruby output type produces incorrect output for numeric types without a value

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-424?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12546910 ] 

Yonik Seeley commented on SOLR-424:
-----------------------------------

If the field has no value, it should not be added to the index.
Think about a field of type "string"... a zero length string is a valid value and should not be confused for an absent value.

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


[jira] Issue Comment Edited: (SOLR-424) The ruby output type produces incorrect output for numeric types without a value

Posted by "Yousef Ourabi (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Commented: (SOLR-424) The ruby output type produces incorrect output for numeric types without a value

Posted by "Yousef Ourabi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-424?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12604992#action_12604992 ] 

Yousef Ourabi commented on SOLR-424:
------------------------------------

The other place I was thinking would be the WriteInt implementation in JsonResponseWriter -- do the check there.  Would that make more sense to you? 

> 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
>            Assignee: Erik Hatcher
>            Priority: Critical
>             Fix For: 1.3
>
>         Attachments: fix_ruby_output.patch, TextResponseWriter-424.java.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.


[jira] Commented: (SOLR-424) The ruby output type produces incorrect output for numeric types without a value

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-424?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12546539 ] 

Yonik Seeley commented on SOLR-424:
-----------------------------------

I believe the underlying issue is that there isn't validation during indexing.
An empty string is not a valid number... if you wish to leave the number out of that document, then leave it entirely out.

For a legacy lucene index, I think a zero length integer field should map to 0, not null (which is not an integer).

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


[jira] Commented: (SOLR-424) The ruby output type produces incorrect output for numeric types without a value

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-424?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12549786 ] 

Yonik Seeley commented on SOLR-424:
-----------------------------------

But we don't allow nil as an integer value when indexing (except by accident), so how can it be a valid value coming back out?  The way to represent "no value" in lucene is to leave the value out.

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


[jira] Assigned: (SOLR-424) The ruby output type produces incorrect output for numeric types without a value

Posted by "Erik Hatcher (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-424?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Erik Hatcher reassigned SOLR-424:
---------------------------------

    Assignee: Erik Hatcher

> 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
>            Assignee: Erik Hatcher
>            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.


[jira] Commented: (SOLR-424) The ruby output type produces incorrect output for numeric types without a value

Posted by "Kurt Schrader (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-424?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12546923 ] 

Kurt Schrader commented on SOLR-424:
------------------------------------

I understand that, but the issue here is how to deal with indexes that have a field with no value in legacy indexes.
To me it seems more logical to return nil to indicate to the user that their field is invalid.

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


[jira] Updated: (SOLR-424) The ruby output type produces incorrect output for numeric types without a value

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-424?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yonik Seeley updated SOLR-424:
------------------------------

    Attachment: zero_length_int.patch

Attaching patch for the output side of things.

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


[jira] Updated: (SOLR-424) The ruby output type produces incorrect output for numeric types without a value

Posted by "Yousef Ourabi (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-424?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yousef Ourabi updated SOLR-424:
-------------------------------

    Attachment: TextResponseWriter-424.java.patch

Slightly more correct version. Can someone please comment on the appropriateness of this patch, and what the wishes and desires are to close this bug.

> 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
>            Assignee: Erik Hatcher
>            Priority: Critical
>             Fix For: 1.3
>
>         Attachments: fix_ruby_output.patch, TextResponseWriter-424.java.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.


[jira] Updated: (SOLR-424) The ruby output type produces incorrect output for numeric types without a value

Posted by "Yousef Ourabi (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-424?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yousef Ourabi updated SOLR-424:
-------------------------------

    Attachment: TextResponseWriter-SOLR-424.patch

Tweak line 115 of TextResponseWriter.writeVal() to test not only for null but zero-length strings?

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


[jira] Commented: (SOLR-424) The ruby output type produces incorrect output for numeric types without a value

Posted by "Kurt Schrader (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-424?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12546905 ] 

Kurt Schrader commented on SOLR-424:
------------------------------------

The problem with making it zero is that it can cause problems if zero is a valid value.  You don't want to run a search for records with a value of zero there and have all of the records with no value turn up as well.

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