Skip to content

Commit

Permalink
Merge pull request #14 from IUBLibTech/custom-metadata
Browse files Browse the repository at this point in the history
IULRDC-5 Implement custom metadata for data catalog
  • Loading branch information
dlpierce authored Nov 13, 2024
2 parents 8124d30 + 1eb73a7 commit 9dbde56
Show file tree
Hide file tree
Showing 6 changed files with 221 additions and 117 deletions.
66 changes: 36 additions & 30 deletions app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ def self.modified_field
end

configure_blacklight do |config|
config.view.gallery(document_component: Blacklight::Gallery::DocumentComponent, icon: Blacklight::Gallery::Icons::GalleryComponent)
config.view.masonry(document_component: Blacklight::Gallery::DocumentComponent, icon: Blacklight::Gallery::Icons::MasonryComponent)
config.view.slideshow(document_component: Blacklight::Gallery::SlideshowComponent, icon: Blacklight::Gallery::Icons::SlideshowComponent)
# config.view.gallery(document_component: Blacklight::Gallery::DocumentComponent, icon: Blacklight::Gallery::Icons::GalleryComponent)
# config.view.masonry(document_component: Blacklight::Gallery::DocumentComponent, icon: Blacklight::Gallery::Icons::MasonryComponent)
# config.view.slideshow(document_component: Blacklight::Gallery::SlideshowComponent, icon: Blacklight::Gallery::Icons::SlideshowComponent)
config.show.tile_source_field = :content_metadata_image_iiif_info_ssm
config.show.partials.insert(1, :openseadragon)
config.search_builder_class = Hyrax::CatalogSearchBuilder
Expand All @@ -30,7 +30,7 @@ def self.modified_field
config.default_solr_params = {
qt: "search",
rows: 10,
qf: "title_tesim description_tesim creator_tesim keyword_tesim"
qf: "title_tesim abstract_tesim description_tesim creator_tesim subject_tesim geographic_location_tesim domain_subject_tesim"
}

# solr field configuration for document/show views
Expand All @@ -51,20 +51,24 @@ def self.modified_field

# solr fields that will be treated as facets by the blacklight application
# The ordering of the field names is the order of the display
config.add_facet_field "human_readable_type_sim", label: "Type", limit: 5
config.add_facet_field "resource_type_sim", label: "Resource Type", limit: 5
config.add_facet_field "creator_sim", limit: 5
config.add_facet_field "contributor_sim", label: "Contributor", limit: 5
config.add_facet_field "keyword_sim", limit: 5
config.add_facet_field "subject_sim", limit: 5
config.add_facet_field "language_sim", limit: 5
config.add_facet_field "based_near_label_sim", limit: 5
config.add_facet_field "publisher_sim", limit: 5
config.add_facet_field "file_format_sim", limit: 5, label: 'File Format'
config.add_facet_field "time_frame_sim", limit: 5, label: 'Timeframe'
config.add_facet_field "data_location_sim", limit: 5, label: 'Data Location'
config.add_facet_field "hosting_unit_sim", limit: 5, label: 'Hosting Unit'
config.add_facet_field "member_of_collection_ids_ssim", limit: 5, label: 'Collections', helper_method: :collection_title_by_id
config.add_facet_field "domain_subject_sim", limit: 10, label: 'Domain Subject'
config.add_facet_field "campus_sim", limit: 10, label: 'Campus'
config.add_facet_field "holding_location_sim", limit: 10, label: 'Hosting Unit'
# config.add_facet_field "rights_statement_sim", limit: 10, label: 'Access Restrictions'
# config.add_facet_field "human_readable_type_sim", label: "Type", limit: 5
# config.add_facet_field "resource_type_sim", label: "Resource Type", limit: 5
# config.add_facet_field "creator_sim", limit: 5
# config.add_facet_field "contributor_sim", label: "Contributor", limit: 5
# config.add_facet_field "keyword_sim", limit: 5
# config.add_facet_field "subject_sim", limit: 5
# config.add_facet_field "language_sim", limit: 5
# config.add_facet_field "based_near_label_sim", limit: 5
# config.add_facet_field "publisher_sim", limit: 5
# config.add_facet_field "file_format_sim", limit: 5, label: 'File Format'
# config.add_facet_field "time_frame_sim", limit: 5, label: 'Timeframe'
# config.add_facet_field "data_location_sim", limit: 5, label: 'Data Location'
# config.add_facet_field "hosting_unit_sim", limit: 5, label: 'Hosting Unit'
# config.add_facet_field "member_of_collection_ids_ssim", limit: 5, label: 'Collections', helper_method: :collection_title_by_id

# The generic_type and depositor are not displayed on the facet list
# They are used to give a label to the filters that comes from the user profile
Expand All @@ -79,24 +83,26 @@ def self.modified_field
# solr fields to be displayed in the index (search results) view
# The ordering of the field names is the order of the display
config.add_index_field "title_tesim", label: "Title", itemprop: 'name', if: false
config.add_index_field "summary_tesim", label: "Summary", itemprop: 'summary', helper_method: :render_markdown
config.add_index_field "keyword_tesim", itemprop: 'keywords', link_to_facet: "keyword_sim"
config.add_index_field "abstract_tesim", label: "Summary", itemprop: 'summary', helper_method: :render_markdown
config.add_index_field "domain_subject_tesim", label: 'Domain Subject', itemprop: 'keywords', link_to_facet: "domain_subject_sim"
config.add_index_field "campus_tesim", label: 'Campus', itemprop: 'campus', link_to_facet: "campus_sim"
config.add_index_field "holding_location_tesim", label: 'Hosting Unit', link_to_facet: "holding_location_sim"
config.add_index_field "rights_statement_tesim", label: 'Access Restrictions', link_to_facet: 'rights_statement_sim', helper_method: :rights_statement_links
# config.add_index_field "subject_tesim", itemprop: 'about', link_to_facet: "subject_sim"
config.add_index_field "creator_tesim", itemprop: 'creator', link_to_facet: "creator_sim"
config.add_index_field "contributor_tesim", itemprop: 'contributor', link_to_facet: "contributor_sim"
config.add_index_field "proxy_depositor_ssim", label: "Depositor", helper_method: :link_to_profile
# config.add_index_field "creator_tesim", itemprop: 'creator', link_to_facet: "creator_sim"
# config.add_index_field "contributor_tesim", itemprop: 'contributor', link_to_facet: "contributor_sim"
# config.add_index_field "proxy_depositor_ssim", label: "Depositor", helper_method: :link_to_profile
# config.add_index_field "depositor_tesim", label: "Owner", helper_method: :link_to_profile
config.add_index_field "publisher_tesim", itemprop: 'publisher', link_to_facet: "publisher_sim"
config.add_index_field "based_near_label_tesim", itemprop: 'contentLocation', link_to_facet: "based_near_label_sim"
config.add_index_field "language_tesim", itemprop: 'inLanguage', link_to_facet: "language_sim"
# config.add_index_field "publisher_tesim", itemprop: 'publisher', link_to_facet: "publisher_sim"
# config.add_index_field "based_near_label_tesim", itemprop: 'contentLocation', link_to_facet: "based_near_label_sim"
# config.add_index_field "language_tesim", itemprop: 'inLanguage', link_to_facet: "language_sim"
# config.add_index_field "date_uploaded_dtsi", itemprop: 'datePublished', helper_method: :human_readable_date
# config.add_index_field "date_modified_dtsi", itemprop: 'dateModified', helper_method: :human_readable_date
# config.add_index_field "date_created_tesim", itemprop: 'dateCreated'
config.add_index_field "rights_statement_tesim", helper_method: :rights_statement_links
config.add_index_field "license_tesim", helper_method: :license_links
config.add_index_field "resource_type_tesim", label: "Resource Type", link_to_facet: "resource_type_sim"
# config.add_index_field "license_tesim", helper_method: :license_links
# config.add_index_field "resource_type_tesim", label: "Resource Type", link_to_facet: "resource_type_sim"
# config.add_index_field "file_format_tesim", link_to_facet: "file_format_sim"
config.add_index_field "identifier_tesim", helper_method: :index_field_link, field_name: 'identifier'
# config.add_index_field "identifier_tesim", helper_method: :index_field_link, field_name: 'identifier'
# config.add_index_field "data_location_tesim", link_to_facet: "data_location_sim"
# config.add_index_field "time_frame_tesim", link_to_facet: "time_frame_sim"
# config.add_index_field "hosting_unit_tesim", link_to_facet: "hosting_unit_sim"
Expand Down
25 changes: 16 additions & 9 deletions app/models/solr_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,21 @@ class SolrDocument

use_extension( Hydra::ContentNegotiation )

attribute :summary, Solr::String, "summary_tesim"
attribute :documentation, Solr::String, "documentation_tesim"
attribute :access_summary, Solr::String, "access_summary_tesim"
attribute :access_process, Solr::String, "access_process_tesim"
attribute :data_location, Solr::Array, "data_location_tesim"
attribute :time_frame, Solr::Array, "time_frame_tesim"
attribute :file_format, Solr::Array, "file_format_tesim"
attribute :hosting_unit, Solr::Array, "hosting_unit_tesim"
attribute :public_contact, Solr::Array, "public_contact_tesim"
attribute :abstract, Solr::Array, "abstract_tesim"
attribute :description, Solr::Array, "description_tesim"
attribute :related_url, Solr::Array, "related_url_tesim"
attribute :rights_notes, Solr::Array, "rights_notes_tesim"
attribute :time_period, Solr::Array, "time_period_tesim"
attribute :subject, Solr::Array, "subject_tesim"
attribute :geographic_location, Solr::Array, "geographic_location_tesim"
attribute :domain_subject, Solr::Array, "domain_subject_tesim"
attribute :creator, Solr::Array, "creator_tesim"
attribute :location_physical, Solr::Array, "location_physical_tesim"
attribute :digital_specifications, Solr::Array, "digital_specifications_tesim"
attribute :expert, Solr::Array, "expert_tesim"
attribute :holding_location, Solr::Array, "holding_location_tesim"
attribute :campus, Solr::Array, "campus_tesim"
attribute :rights_statement, Solr::Array, "rights_statement_tesim"
attribute :bibliographic_citation, Solr::Array, "bibliographic_citation_tesim"

end
5 changes: 3 additions & 2 deletions app/presenters/hyrax/data_set_presenter.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module Hyrax
class DataSetPresenter < Hyrax::WorkShowPresenter
delegate :summary, :documentation, :access_summary, :access_process, :data_location, :time_frame,
:file_format, :hosting_unit, :public_contact,
delegate :abstract, :description, :related_url, :rights_notes, :time_period, :subject,
:geographic_location, :domain_subject, :creator, :location_physical, :digital_specifications,
:expert, :holding_location, :campus, :rights_statement, :bibliographic_citations,
to: :solr_document
end
end
14 changes: 14 additions & 0 deletions app/renderers/hyrax/renderers/markdown_attribute_renderer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true
module Hyrax
module Renderers
class MarkdownAttributeRenderer < AttributeRenderer
private

def attribute_value_to_html(value)
# text = value.join("\n\n")
text = value
DataCatalog::MarkdownService.call(text).html_safe
end
end
end
end
47 changes: 16 additions & 31 deletions app/views/hyrax/base/_attribute_rows.html.erb
Original file line number Diff line number Diff line change
@@ -1,31 +1,16 @@
<%= presenter.attribute_to_html(:documentation, html_dl: true) %>
<%= presenter.attribute_to_html(:access_summary, html_dl: true) %>
<%= presenter.attribute_to_html(:access_process, html_dl: true) %>
<%= presenter.attribute_to_html(:time_frame, render_as: :faceted, html_dl: true) %>
<%= presenter.attribute_to_html(:subject, render_as: :faceted, html_dl: true) %>
<%= presenter.attribute_to_html(:data_location, render_as: :faceted, html_dl: true) %>
<%= presenter.attribute_to_html(:file_format, render_as: :faceted, html_dl: true) %>
<%= presenter.attribute_to_html(:public_contact, html_dl: true) %>
<%= presenter.attribute_to_html(:hosting_unit, render_as: :faceted, html_dl: true) %>

<%= presenter.attribute_to_html(:alternative_title, html_dl: true) %>
<%= presenter.attribute_to_html(:abstract, html_dl: true) %>
<%= presenter.attribute_to_html(:date_modified, label: t('hyrax.base.show.last_modified'), html_dl: true) %>
<%= presenter.attribute_to_html(:creator, render_as: :faceted, html_dl: true) %>
<%= presenter.attribute_to_html(:contributor, render_as: :faceted, html_dl: true) %>

<%= presenter.attribute_to_html(:publisher, render_as: :faceted, html_dl: true) %>
<%= presenter.attribute_to_html(:bibliographic_citation, html_dl: true) %>
<%= presenter.attribute_to_html(:language, render_as: :faceted, html_dl: true) %>
<%= presenter.attribute_to_html(:identifier, render_as: :linked, search_field: 'identifier_tesim', html_dl: true) %>
<%= presenter.attribute_to_html(:keyword, render_as: :faceted, html_dl: true) %>
<%= presenter.attribute_to_html(:date_created, render_as: :linked, search_field: 'date_created_tesim', html_dl: true) %>
<%= presenter.attribute_to_html(:based_near_label, html_dl: true) %>
<%= presenter.attribute_to_html(:related_url, render_as: :external_link, html_dl: true) %>
<%= presenter.attribute_to_html(:resource_type, render_as: :faceted, html_dl: true) %>
<%= presenter.attribute_to_html(:source, html_dl: true) %>
<%= presenter.attribute_to_html(:extent, html_dl: true) %>
<%= presenter.attribute_to_html(:rights_statement, render_as: :rights_statement, html_dl: true) %>
<%= presenter.attribute_to_html(:rights_notes, html_dl: true) %>
<%= presenter.attribute_to_html(:access_right, html_dl: true) %>
<%= presenter.attribute_to_html(:license, render_as: :license, html_dl: true) %>
<%= presenter.attribute_to_html(:abstract, label: 'Summary', render_as: :markdown, html_dl: true) %>
<%#= presenter.attribute_to_html(:description, label: 'Description', render_as: :markdown, html_dl: true) %>
<%= presenter.attribute_to_html(:related_url, label: 'Documentation', render_as: :external_link, html_dl: true) %>
<%= presenter.attribute_to_html(:rights_notes, label: 'Access Instructions', html_dl: true) %>
<%= presenter.attribute_to_html(:time_period, label: 'Timeframe', html_dl: true) %>
<%= presenter.attribute_to_html(:subject, label: 'Keyword Subject', html_dl: true) %>
<%= presenter.attribute_to_html(:geographic_location, label: 'Spatial Subject', html_dl: true) %>
<%= presenter.attribute_to_html(:domain_subject, label: 'Domain Subject', render_as: :faceted, html_dl: true) %>
<%= presenter.attribute_to_html(:creator, label: 'Creator', html_dl: true) %>
<%= presenter.attribute_to_html(:location_physical, label: 'Data Location', html_dl: true) %>
<%= presenter.attribute_to_html(:digital_specifications, label: 'File Format(s)', html_dl: true) %>
<%= presenter.attribute_to_html(:expert, label: 'Public Contact', html_dl: true) %>
<%= presenter.attribute_to_html(:holding_location, label: 'Hosting Unit', render_as: :faceted, html_dl: true) %>
<%= presenter.attribute_to_html(:campus, label: 'Campus', render_as: :faceted, html_dl: true) %>
<%= presenter.attribute_to_html(:rights_statement, label: 'Access Restrictions', render_as: :rights_statement, html_dl: true) %>
<%= presenter.attribute_to_html(:bibliographic_citation, label: 'Bibliographic Citation', html_dl: true) %>
Loading

0 comments on commit 9dbde56

Please sign in to comment.