You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NaN values should be allowed for upload when using simplejson
Actual behaviour
[...]
File "<software-path>/lib/python3.11/site-packages/simplejson/encoder.py", line 379, in iterencode
return _iterencode(o, 0)
^^^^^^^^^^^^^^^^^
ValueError: Out of range float values are not JSON compliant
In version 3.19.0, simplejson deciced to change the default value for allow_nan to False for simplejson.dumps (Ctrl+F The default for allow_nan), which is used in pysolr 3.9.0 and simplejson.JSONEncoder (Ctrl+F 3.19.0: This default), used in pysolr 3.10 betas.
When not using simplejson but the default Python-JSON (which is done when simplejson is not available), this is not an issue, as NaN is allowed by default. This should be consistent across the different en-/decoders.
Possible solution
Explicitly set allow_nan=True when using simplejson
Configuration
Operating system version:
Search engine version:
Python version: 3.11.3
pysolr version: 3.9.0
simplejson version: 3.19.1
The text was updated successfully, but these errors were encountered:
I have
Expected behaviour
NaN
values should be allowed for upload when usingsimplejson
Actual behaviour
Steps to reproduce the behaviour
simplejson >= 3.19.0
available on the systempysolr.Solr(<SOLR_URL>).add([{'key': float('nan')}])
Reason
In version 3.19.0,
simplejson
deciced to change the default value forallow_nan
toFalse
for simplejson.dumps (Ctrl+FThe default for allow_nan
), which is used inpysolr 3.9.0
and simplejson.JSONEncoder (Ctrl+F3.19.0: This default
), used inpysolr 3.10 betas
.When not using simplejson but the default Python-JSON (which is done when simplejson is not available), this is not an issue, as
NaN
is allowed by default. This should be consistent across the different en-/decoders.Possible solution
Explicitly set
allow_nan=True
when usingsimplejson
Configuration
The text was updated successfully, but these errors were encountered: