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

Donovan Jimenez commented on SOLR-1270:
---------------------------------------

Matt is refering to the code I posted in 
http://code.google.com/p/solr-php-client/issues/detail?id=13#c8 Where I indexed 
php values null, 0, "0", and ".0" as FloatField.   

I agree with Hoss here, the ".0" or null IS garbage according to the JSON 
numeric (json.org) and Java Floating Point Literal specifations 
(http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#230798).
   

What I don't understand is why it wouldn't be beneficial for the FloatField 
type to use Float.parseFloat() for value checking at index time. My opinion is 
that the pro of directly letting the user know their input document does not 
match the expectations of their schema outweighs the con of  the time it takes 
to parse the value.  It doesn't remove the need for separate documentation, but 
getting the error at index time makes more sense then getting a JSON parsing 
error when querying. The cause and effect become less detached.


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