Hello!
I am working through the process of adding a new Repository facet to the Authority record browse and Authority record view pages and am hoping to get some input as to the best way to accomplish this. I am hoping that you can let me know if I am on the right track here or not! :)
As far as putting a facet on the Authority record view page, I have not yet begun to look at this in detail. Any tips on this would be appreciated!
With regard to adding a Repository facet to the Auth record browse screen, I will need to:
1) add a property 'repository_id' in the mappings.yml file for the 'Actor' type. e.g.:
actor:
_attributes:
i18n: true
timestamp: true
autocompleteFields: [authorizedFormOfName]
rawFields: [authorizedFormOfName]
dynamic: strict
properties:
slug: { type: string, index: not_analyzed }
description_identifier: { type:string, index: not_analyzed }
entity_type_id: { type: integer, index: not_analyzed, include_in_all: false }
repository_id: { type: integer, index: not_analyzed, include_in_all: false }
I had considered trying to add the Repository type as a "_foreign_types" to the Actor type in mappings.yml but I don't think this gets me what I want (a repository facet) so I abandoned this.
2) update the plugins/arElasticSearchPlugin/lib/model/arElasticSearchActorPdo.class.php (and not arElasticSearchActor.class.php) to associate the repository ID with the QubitActor in Elasticsearch. This would leverage what I build in (3) below to get all the repository_id's and serialize them. Is the pdo class the correct place to put this?
3) add a method to lib/model/QubitActor.php that will return the repositories that are linked to the Actor via its relationships. (The fonds are associated to the Actor using the "Relationships Area" when an Actor is edited. SQL that does what I think it should do is as follows (this is an e.g. I was using to get the repos for a test Actor):
SELECT r2.* FROM `actor`
left join relation on relation.object_id = actor.id left join event on event.actor_id = actor.id left join information_object as t2 on event.information_object_id = t2.id left join repository on repository.id = information_object.repository_id left join repository as r2 on r2.id = t2.repository_id
4) My initial thoughts are that code will have to be added to facilitate the dropping of the Relationships so that if a Repository is removed from the Actor in the Names detail window, that this is removed from Elasticsearch. Do I have this correct? I am not sure yet where this needs to be added.
Thanks,
Steve