internetarchive / internetarchive/openlibrary

API: only one edition provided when calling search with editions field

Open
#7,332 8 comments 1 reaction 0 assignees View on GitHub
Lead: @cdrini Priority: 2 Theme: Public APIs Theme: Search Type: Feature Request
Dominant language
Python
Stars
6.7k
Forks
2k
Avg merge
2d 19h
Merged PRs (30d)
138

Description

When calling `search` endpoint with `editions` field specified `docs` collection under editions always have only one element, example:
https://openlibrary.org/search.json?q=black%20swan&fields=key,title,editions

### Evidence / Screenshot (if possible)
Response:
```json
{
"numFound": 1794,
"start": 0,
"numFoundExact": true,
"docs": [
{
"key": "/works/OL8070930W",
"title": "The black swan",
"editions": {
"numFound": 7,
"start": 0,
"numFoundExact": true,
"docs": [
{
"key": "/books/OL6274386M",
"title": "The black swan"
}
]
}
},
...
]
}
```

`numFound` indicates there's 7 editions, we can see them listed on https://openlibrary.org/works/OL8070930W/The_black_swan but the JSON response contains only one of them.

### Relevant url?
https://openlibrary.org/search.json?q=black%20swan&fields=key,title,editions

### Steps to Reproduce

1. Go to https://openlibrary.org/search.json?q=black%20swan&fields=key,title,editions
2. Check number of editions returned for each `doc`

* Actual: there's only one `edition` record returned for each `doc`, even if `numFound` member value is greater than `1`
* Expected: all edition should be returned

### Details

- **Logged in (Y/N)?**
- **Browser type/version?**
- **Operating system?**
- **Environment (prod/dev/local)?** prod

### Proposal & Constraints

### Related files

### Stakeholders

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.