lucene-solr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Schraeder (JIRA)" <>
Subject [jira] Commented: (SOLR-1270) The FloatField (and probably others) field type takes any string value at index, but JSON writer outputs as numeric without checking
Date Fri, 17 Jul 2009 05:01:14 GMT


Matt Schraeder commented on SOLR-1270:

Let me clarify a bit, because I don't think I came across how I meant to.  There are two issues
at work here.

1) The fact that the index lets you add invalid data to an index. Solr should either do it's
best to parse the value as a float that it's expecting, or it should throw an error saying
you gave it invalid data that doesn't match the field.  If speed is more important that verification,
that's your decision and I can agree with that

2) When I WAS passing in valid data to the index, I was passing in small float values such
as 0.0 and 0.5. Basically, any value < 1.  Solr's JSONWriter wasn't returning these values
as 0.0 or 0.5, which would be the proper return.  They were returning the value without the
leading 0.  By not having the leading 0, php's JSON decode fails because the value it's receiving
is ".0" or ".5".  The period before hand it interprets as a string, rather than a decimal,
but as long as there was a number before the decimal it was fine (1.5 came out as 1.5 and
was interpreted as a float by JSON decode properly.

These, in my opinion, are the same bug: JSON Writer is returning invalid JSON.  In issue 1,
yes it's because of invalid data in the index.  If the index is bad I cannot expect the JSON
to be valid.  In issue 2 the data in SOLR is valid and stored/returned properly as 0.5 with
the leading 0, but in the JSON not having the leading 0 is breaking validation and keeping
the user from being able to properly decode the JSON string.

> The FloatField (and probably others) field type takes any string value at index, but
JSON writer outputs as numeric without checking
> ------------------------------------------------------------------------------------------------------------------------------------
>                 Key: SOLR-1270
>                 URL:
>             Project: Solr
>          Issue Type: Bug
>          Components: search
>    Affects Versions: 1.2, 1.3, 1.4
>         Environment: ubuntu 8.04, sun java 6, tomcat 5.5
>            Reporter: Donovan Jimenez
>            Priority: Minor
> The FloatField field type takes any string value at index. These values aren't necessarily
in JSON numeric, but the JSON writer does not check its validity before writing it out as
a JSON numeric.
> I'm aware of the SortableFloatField which does do index time verification and conversion
of the value, but the way the JSON writer is working seemed like either a bug that needed
addressed or perhaps a gotch that needs better documented?
> This issue originally came from my php client issue tracker:

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message