Skip to content

Copy cover_i key from Solr. Fixes #11563 - #11696

Merged
cdrini merged 2 commits into
internetarchive:masterfrom
tfmorris:11563-single-edition-work-cover
Jul 6, 2026
Merged

Copy cover_i key from Solr. Fixes #11563#11696
cdrini merged 2 commits into
internetarchive:masterfrom
tfmorris:11563-single-edition-work-cover

Conversation

@tfmorris

Copy link
Copy Markdown
Contributor

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

Screenshot 2026-01-13 at 22 50 47

Stakeholders

Copilot AI review requested due to automatic review settings January 14, 2026 03:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_i field extraction from Solr documents in the get_doc() function

πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread openlibrary/plugins/worksearch/code.py Outdated
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),

Copilot AI Jan 14, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It sounds like the existing test has codified the incorrect behavior. I'll have a look when I get a chance.

@tfmorris
tfmorris force-pushed the 11563-single-edition-work-cover branch from fb85c2c to 938109e Compare May 26, 2026 00:06
@tfmorris
tfmorris force-pushed the 11563-single-edition-work-cover branch from 938109e to 7b703c5 Compare May 26, 2026 00:16
@tfmorris

Copy link
Copy Markdown
Contributor Author

@cdrini This has been rebased and the test failure fixed.

@cdrini cdrini left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed on testing this fixes the issue.

@cdrini
cdrini merged commit 63c73dd into internetarchive:master Jul 6, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs: Response Issues which require feedback from lead

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Work cover image not displayed in search results when "Solr editions" disabled

3 participants