Skip to content

Commit

Permalink
Merge pull request #611 from scientist-softserv/collection-uris-to-st…
Browse files Browse the repository at this point in the history
…rings

🎁 Add URI to human readable string to collections
  • Loading branch information
kirkkwang authored Mar 1, 2024
2 parents a02f2f1 + 3a0de35 commit 787e895
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/indexers/collection_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@ class CollectionIndexer < Hyrax::CollectionIndexer
# This indexes the default metadata. You can remove it if you want to
# provide your own metadata and indexing.
include Hyrax::IndexesBasicMetadata
include UriToStringBehavior

# Uncomment this block if you want to add custom indexing behavior:
def generate_solr_document
super.tap do |solr_doc|
solr_doc["creator_tesim"] = all_creators
solr_doc["bulkrax_identifier_sim"] = object.bulkrax_identifier
solr_doc["account_cname_tesim"] = Site.instance&.account&.cname
solr_doc[CatalogController.title_field] = object.title.first
end
end

private

def all_creators
SolrDocument.creator_fields.map { |prop| uri_to_value_for(object.try(prop)) }.flatten.compact
end
end

0 comments on commit 787e895

Please sign in to comment.