Open mekarpeles opened 1 year ago
@cdrini to write docs on which solr work query to use
The query we'll want is something like:
run_solr_query(
WorkSearchScheme(),
f'key:"{work_key}"',
rows=1,
fields=['key', 'editions'],
)
That should return a result like this: https://testing.openlibrary.org/search.json?q=key%3A%2Fworks%2FOL24156W&mode=everything&fields=key,editions
Note: I've fixed a bug with this endpoint that was preventing it from working correctly with key
, so the link above is for testing. The PR for that bug fix is #8642 .
Thanks @cdrini!
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
Details
work
from infogamieditions
from solr → new logic to select the best one (consider providers too)edition
from infogamieditions
from solr and also see if we can eliminate the extra call for theedition
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 movingeditions
from infogami to solr.Needs
A fully complete book record for testing