scientist-softserv / iiif_print

A gem for Hyrax/Samvera for displaying PDF pages in a IIIF Compliant viewer
Apache License 2.0
4 stars 1 forks source link

Updating allinson flex features #231

Closed kirkkwang closed 1 year ago

kirkkwang commented 1 year ago

Filter out admin_only fields

This commit will filter out metadata fields that are meant to be admin only from displaying in the UV. This is done by adding a reject if the Allinson Flex profile indicates that this field is admin_only.


Make QA work for allinson_flex

Allinson Flex profiles don't have an option other than indicating which fields to be facetable. This commit will make QA work for Allinson Flex by assuming the field names "rights_statement" and "license" will be QA fields.


Add a way to sort Allinson Flex metadata

This configuration allows you to sort the metadata within an application that uses Allinson Flex. In a non-Allinson Flex application, you would use the IiifPrint.config.metadata_fields to sort the metadata. However, in Allinson Flex, the fields come in according to the m3 profile. This configuration allows you to use an Array of Symbols to sort the metadata in an intentional way.

Some profiles have fields with the same name repeated. This commit will remove repeated fields though this functionality just takes the first field and ignores the rest. This isn't very controlled at the moment but works for Essi's situation.

Ex. Imagine if you had fields of:

[
  #<AllinsonFlex::ProfileProperty id: nil, name: "title", indexing: ["stored_searchable"]>,
  #<AllinsonFlex::ProfileProperty id: nil, name: "title", indexing: ["stored_searchable"]>
 ]

The first object would yield Title: My Sweet Title

and the second field would yield Photograph Information: My Sweet Title

The second field would be ignored since the value is the same as the first field. This is how Essi displays their metadata so we will use this method until told otherwise.


Ensure we're using a SolrDcoument

For Essi to use the #manifest_metadata method, we need to ensure that the model is a SolrDocument. We will now make a check to see if the model is a SolrDocument, and if not, we will attempt to convert it to one.