Open scottbarnes opened 2 months ago
@mekarpeles May I work on this!!
I've assigned this to you, @Naresh-kumar-Thodupunoori. Please ask any questions you may have, and when you submit your PR, please include before and and after input and output so it's easy to verify, as a threshold matter, that the PR resolves the issue.
FWIW, a recent bulk MARC import has imported an item with multiple language codes: https://openlibrary.org/books/OL53206387M/%E6%B3%95%E6%80%9D%E6%83%B3
it was imported using the /api/import/ia
endpoint
Hey @scottbarnes I am unlikely not able to finish the issue. So I unassigned the issue.
Thank you for the heads up, @Naresh-kumar-Thodupunoori, and thank you for the tip about a book being imported via /api/import/ia
that includes multiple languages, @hornc.
For anyone looking to work on this, it may be the case that bulk_marc
imports are different from the one-off import via an 'individual' OCAID/Internet Archive identifier.
Problem
Imports via
load()
that specify multiple languages seem to only accept one language. It is unclear if this only applies to the/api/import/ia
endpoint.It should be tested with other endpoints, such as
/api/import
. See the Developer's Guide to Data Importing for the many fun ways to import via the various endpoints with various languages and tools.Evidence / Screenshot
Consider the IA item 2e013a64-935f-4be4-9c51-3eac22929627, which has two languages.
Importing it, with #9480 applied (and #9480 MUST be applied or already in
master
), works:However, once imported, it only has
English
as a language:Spanish
has disappeared into the ether.Reproducing the bug
/api/import/ia
that has multiple languages, such asocaid
2e013a64-935f-4be4-9c51-3eac22929627
.English
andSpanish
show up in the edition as languages.English
shows up.Context
Notes from this Issue's Lead
Proposal & constraints
Related files
This will take more research, but by the time the
rec
gets tobuild_query
inopenlibrary/catalog/add_book/load_book.py
, the only language code isENG
: https://github.com/internetarchive/openlibrary/blob/c546c6ab62c6435796109ca6a8169a673b842c75/openlibrary/catalog/add_book/load_book.py#L288-L324You'll have to trust me, but this is from a
print(f"{rec = }", flush=True)
called just after the docstring inbuild_query
:Stakeholders
Instructions for Contributors
master
. Without it, the import via/api/import/ia
will fail.