The first JSON is invalid as you see because of the missing value.

:, is not valid JSON syntax.

The reason it works for string type is because the empty string '' is a
valid field value but _nothing_ (the first examepl) is not. There is no
empty float placeholder that JSON likes. So either it has to be an empty
string or some legitimate float value.

FAIK, Solr doesn't generate empty numeric values compatible with JSON.
zero and null are different things.



> I'm not sure, but I think I ran across some unexpected behavior in the
> python response in solr 1.3 (1.3.0 694707 - grantingersoll - 2008-09-12
> 11:06:47).
>
> I'm running Python 2.5 and using eval to convert the string solr returns
> to python data objects.
>
> I have a blank field in my xml file that I am importing labeled
> "contacthours". If I make the field a "string" type, the interpreter
> doesn't throw an error. If I make the field a "float" type, python
> throws an error on the eval function. Here is portion of the output from
> solr, with the two differences near the end by the "contacthours"
> variable:
>
>
> Broken (Python didn't like this):
> {'responseHeader':{'status':0,'QTime':0,'params':{'q':'id:"161"','wt':'p
> ython'}},'response':{'numFound':1,'start':0,'docs':[{'approvalpending':'
> ','assessmentcourseprograminstitutionimprovement':u'The students\u2019
> final reports along with the \u201cBiology Externship Completion
> Form\u201d, which is completed by externship supervisors, will be used
> for this assessment.','contacthourrationale':'Variable hours - no
> explanation given','contacthours':,'coursearea':'BIO',
>
>
> Good (this worked):
> {'responseHeader':{'status':0,'QTime':0,'params':{'q':'id:"161"','wt':'p
> ython'}},'response':{'numFound':1,'start':0,'docs':[{'approvalpending':'
> ','assessmentcourseprograminstitutionimprovement':u'The students\u2019
> final reports along with the \u201cBiology Externship Completion
> Form\u201d, which is completed by externship supervisors, will be used
> for this assessment.','contacthourrationale':'Variable hours - no
> explanation given','contacthours':'','coursearea':'BIO',
>
>
> Any insights? Is this a bug or am I missing something?
>
> Mike Beccaria
> Systems Librarian
> Head of Digital Initiatives
> Paul Smith's College
> 518.327.6376
> mbecca...@paulsmiths.edu
>
>
>

Reply via email to