Copy cover_i key from Solr. Fixes #11563 - #11696
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes issue #11563 by ensuring that the cover_i field from Solr documents is properly copied to the result object returned by get_doc(). The cover_i field contains the cover ID which is used by templates to display book covers.
Changes:
- Added
cover_ifield extraction from Solr documents in theget_doc()function
π‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| first_edition=doc.get('first_edition', None), | ||
| subtitle=doc.get('subtitle', None), | ||
| cover_edition_key=doc.get('cover_edition_key', None), | ||
| cover_i=doc.get('cover_i', None), |
There was a problem hiding this comment.
The existing test for get_doc in openlibrary/plugins/worksearch/tests/test_worksearch.py should be updated to include cover_i in both the input document and expected output to ensure this field is properly tested.
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
There was a problem hiding this comment.
It sounds like the existing test has codified the incorrect behavior. I'll have a look when I get a chance.
fb85c2c to
938109e
Compare
938109e to
7b703c5
Compare
|
@cdrini This has been rebased and the test failure fixed. |
cdrini
left a comment
There was a problem hiding this comment.
Confirmed on testing this fixes the issue.
Closes #11563
Technical
This code should probably be refactored so that it's not copying keys individually, but this fix just keeps the existing pattern.
Testing
copydoc the work from the original bug report
use the same search URL in your local dev instance
make sure Solr editions is NOT checked.
Screenshot
Stakeholders