denshoproject / ddr-public

Web UI for publishing DDR collections.
Other
1 stars 1 forks source link

Interviews with multiple narrators not showing on Narrator page #210

Closed sarabeckman closed 1 year ago

sarabeckman commented 1 year ago

This bug was first noticed with this interview with 3 narrators: Kay Uno Kaneko - Hana Shepard - Mae Matsuzaki Interview. The interview does not show up on the Narrator pages for Kay Kanekoor Hana Shepard but does show up for Mae Matsuzaki.

The behavior is also seen with this interivew: Terry Aratani - Fred Matsumura - Kenneth Okuma - Henry Bruno Yamada Interview. The interview does not appear on the Narrator pages for Terry Aratani, Kenneth Okuma, or Fred Matsumura. The interview does show up for Henry Bruno Yamada.

I have checked the data for the interviews and the data is correct.

gjost commented 1 year ago

The view gets data from ui.models.Narrator.interviews, which searches for Entity objects with format="vh" and the specified narrator_id. Entity objects in the DDR API have a narrator_id field, which does not appear in ddr-defs:repo_models.elastic.Entity. narrator_id is added in DDR.models.common.to_esobject which is invoked by ddrindex publish. All of this probably predates creator with role:narrator.

The API data for ddr-densho-1007-8 lists the interviewees in creators with role=narrator. We need to rework ui.models.Narrator.interviews to search on this instead of narrator_id.

gjost commented 1 year ago

OMG this works...

DOCSTORE.es.sql.query(body={'query': """SELECT id FROM ddrentity WHERE creators.id=838 AND creators.role='narrator'"""})

I wish I could replace all the elasticsearch_dsl code with SQL...

gjost commented 1 year ago

Existing code in ddrpublic/ui/models/interviews relied on a narrator_id field present in Interview Entity objects. This field was an int and appropriate for singular narrators, not lists of narrators.

Found a solution (forthcoming) that involves modifying ddrpublic/ui/models/interviews and elastictools.search.prepare to search for interviews using creator.id and creator.role.

gjost commented 1 year ago

Fixed in commit 6c42031, merged in to master, packaged, and installed in prod.