internetarchive / internetarchive/openlibrary
Books Page: Get Best Edition → Solr
- Dominant language
- Python
- Stars
- 6.7k
- Forks
- 2k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 138
Description
Related to #7451, performance
### Describe the problem that you'd like solved
When a reader visits a Book Page, many of its editions are fetched, e.g. for the Other Editions table or to find the best edition: (https://github.com/internetarchive/openlibrary/blob/master/openlibrary/templates/type/edition/view.html#L41-L71). This process requires we fetch all the editions from infogami (rather than solr). This function should make a single solr call (instead of infogami db) -- potentially the same call which is required for loading the #7451. By using solr, we can also do a better job about choosing the desired edition (since we know more about the target language, etc)
## Unknowns / Risks
* Solr fields may be different form infobase for editions and we'll want to be careful that the edition we fetch to render the books page is in the format we need -- this may entails functions that are called on the edition model (which solr records won't have)
* We likely want to use solr to fetch the correct set of representative works (i.e. all books that have some read/preview option -- not limiting to 10 like we are for infobase)
* Specifically for the edition we're using the load the book page, we may want to fetch this from infobase so it is hydrated with everything we need.
## Details
* The books page will fetch…
* the `work` from infogami
* the `editions` from solr → new logic to select the best one (consider providers too)
* the `edition` from infogami
* The goal is eventually to replace the editions table with the `editions` from solr and also see if we can eliminate the extra call for the `edition` from infogami (in that order of priority – i.e. editions table, first). But this can all be done later because it’s significantly more work and the clear win is moving `editions` from infogami to solr.
## Needs
A fully complete book record for testing
Contributor guide
Research direction
Start with openlibrary/templates/type/edition/view.html around lines 41-71 and trace how the Book Page fetches editions from infogami; compare the related #7451 work and the Solr data available for editions. Done means the editions are fetched with one Solr call and the best edition can be selected for the page, validated using a fully complete book record.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, search
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100