New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solr.add with datetime instance causes TypeError #317
Comments
I see there was no reply yet to this issue. Is there any plan to solve it or at least any suggested workaround? |
You can go back to using the XML interface using the optional parameter, call isoformat() on the date objects before passing them in. It would be nice if we had a JSON encoder which handles this, too, if you have time to contribute one. |
Thanks for the suggestion. Regarding the encoder, I will not have the time, unfortunately. |
Calling
pysolr.Solr.add
with a dict containing adatetime
object causes the following stack trace:I believe this change to be the breaking change.
Before this change the datetime object could propagate via
self._build_doc
toself._from_python
where the first check would have converted it to a string.I have
Expected behaviour
No exception
Actual behaviour
TypeError: Object of type datetime is not JSON serializable
Configuration
The text was updated successfully, but these errors were encountered: