Skip to content

Fixed: Different JSON and XML behaviour #322

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

Merged
merged 2 commits into from
May 24, 2020

Conversation

ahankinson
Copy link
Contributor

@ahankinson ahankinson commented May 23, 2020

This commit adds a _build_json_doc method that strips keys with empty values from the doc prior to being serialized to JSON. This behaviour matches the behaviour of the XML method. It also uses the same method (_is_null_value) so if this behaviour needs to change in the future it should remain consistent.

It includes a new test to ensure the behaviours of the two methods remain consistent.

Fixes #321

This commit adds a _build_json_doc method that strips keys with empty values from the doc prior to being serialized to JSON. This behaviour matches the behaviour of the XML method. It also uses the same method (_is_null_value) so if this behaviour needs to change in the future it should remain consistent.

It includes a new test to ensure the behaviours of the two methods remain consistent.

Fixes django-haystack#321
@codecov
Copy link

codecov bot commented May 23, 2020

Codecov Report

Merging #322 into master will increase coverage by 0.11%.
The diff coverage is 94.73%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #322      +/-   ##
==========================================
+ Coverage   94.20%   94.31%   +0.11%     
==========================================
  Files           7        7              
  Lines        1328     1338      +10     
==========================================
+ Hits         1251     1262      +11     
+ Misses         77       76       -1     
Impacted Files Coverage Δ
pysolr.py 89.44% <88.88%> (+0.20%) ⬆️
tests/test_client.py 99.63% <100.00%> (+<0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b646e96...08cf0d8. Read the comment docs.

@acdha acdha merged commit 498b088 into django-haystack:master May 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Different behaviour for empty strings in JSON and XML
2 participants