-
Notifications
You must be signed in to change notification settings - Fork 50
attribution
is null in search results view
#1036
Comments
@sarayourfriend I checked and both have the
We need a different example to reproduce. |
Oh interesting! It looks like attribution is only null on the search results view but not the detail view: https://api.openverse.engineering/v1/images/?q=dog The null attribution result I just copied the detail link without actually checking it, my bad! It looks like the reason for this is because in the detail view we're passing the media model to the serializer, whereas for the results view, we're passing the ES results. Because To solve this we could add Do you think that would be an appropriate solution, @dhruvkb? |
attribution
is sometimes nullattribution
is null in search results view
@sarayourfriend that makes total sense, we already do something like this for the
If the To be fair, I can rationalize the attribution being missing on the search results as a way to reduce our DB queries and speed up the results. If we get the media model instance for each |
Is this true even if we do the query for the DB data before sending the results to the serializer? If we need the API DB data for each result a Luckily, I think all the things we need to build the attribution are present in the index anyway: |
For the audio one, by the way, would we be able to do as I suggested in the immediately previous comment? That is, lift the query for the full list of media objects into the view instead of serializing from the |
I seem to remember some work you've done on ES improvements, @dhruvkb, included adding all of the model fields to the ES Hit results. So, even though only some of the fields are used by the ES for search indexing, all of the fields (even the non-indexed ones) will be available in the search results. This way we wouldn't have to make a new request for additional information. This is the specific place where I've got this from:
Could that solve the issue with attribution? |
Description
Example where it is not null: https://api.openverse.engineering/v1/images/0aff3595-8168-440b-83ff-7a80b65dea42/
Example where it is null: https://api.openverse.engineering/v1/images/?q=dog
See any of the results and attribution will be null for them. If you go to the detail view for the result, it will be populated.
See this comment for an explanation of why and a potential fix: #1036 (comment)
Reproduction
Additional context
Discovered by @zackkrida and @krysal in Make Slack here: https://wordpress.slack.com/archives/C02012JB00N/p1670442907182319 (Requires a free account from https://chat.wordpress.org to access).
Resolution
The text was updated successfully, but these errors were encountered: