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

Hoss Man commented on SOLR-1270:
--------------------------------

bq. Hoss: You're misunderstanding something.

i must be

bq. for example: "0.5", then the JSON encoder spits out ".0" without the quotes.

I do not see how that is even remotely possible.  I think there must be a typo 
there in your comment -- if not, please provide a unit test demonstrating what 
you are seeing.

I'm guessing that what you *ment* to say, was "if i index the value of '0.5' 
then JSON outputs '.5'" ... which i'm also not seeing when I attempt it myself 
(tested using the trunk, indexing docs using raw XML).

If you are seeing this behavior (input: '0.5'; json output: '.5') then I 
suggest there may be a bug in whatever mechanism you are using to create the 
index (DataImportHandler, CSVUpdateRequestHandler, some client library, 
acts_as_solr, etc...)  What does the value look like in the XML response? what 
does the LukeRequestHandler say your indexed values look like (because they 
should all be exactly the same) ... if your initial data has '0.5' in it but 
those three handlers all display '.5' then please let us know how you built 
your index because it sounds like that has a bug)

The other possibility is that you might have ment to say "if i index the value 
of '.5' then JSON outputs '.5'" ... which is exactly my point before: garbage 
in, garbage out.

'.5' is not the canonical representation of any float value -- there may be 
some parsers that are tolerant of it (Float.valueOf() in java for example) but 
that doesn't mean it's a legal float value.  parsers can make sense of 
'0.00006' as well, but that's not the proper string representation, '6.0E-5' is 
the correct way to represent that float value as a 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: https://issues.apache.org/jira/browse/SOLR-1270
>             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
>             Fix For: 1.4
>
>         Attachments: SOLR-1270.patch
>
>
> 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: 
> http://code.google.com/p/solr-php-client/issues/detail?id=13

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

Reply via email to