-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update index_parent_collections to use solr doc url if exists #3844
Conversation
3c0017f
to
320fe42
Compare
@dnoneill I don't think this does what we want. Some collections are released to searchworks and the desired behavior is that if the collection is in searchworks it links to the collection record in searchworks. For example, this https://searchworks.stanford.edu/catalog?f%5Bcollection%5D%5B%5D=bc677qs7597 links to https://searchworks.stanford.edu/view/bc677qs7597. With the change you've proposed in this PR it would link to PURL instead at https://purl.stanford.edu/bc677qs7597. On the record page I believe SearchWorks queries the SearchWorks Solr index to determine that the collection record exists before linking to it. That probably isn't a scalable approach from the index page where there could be 100 records with collection links to look up, but illustrates the problem. I think we'd need some information on the object record to tell us if the parent collection has been released so SearchWorks knows what to do. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should probably be a test added around index_parent_collections
for this change.
@@ -31,7 +31,8 @@ | |||
<dt>Digital collection</dt> | |||
<dd> | |||
<% document.index_parent_collections.each do |collection| %> | |||
<%= link_to(helpers.document_presenter(collection).heading, solr_document_path(collection))%> | |||
<% collection_url = collection['url'] ? collection['url'] : solr_document_path(collection) %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you be able to move this whole block to a new method SearchResult::Item::Mods::MetadataComponent#collection_link
? It's good practice to move logic out of the templates.
@@ -19,7 +19,8 @@ def index_parent_collections | |||
unless @index_parent_collections | |||
@index_parent_collections = self[:collection_with_title].map do |collection_with_title| | |||
id, title = collection_with_title.split('-|-').map(&:strip) | |||
SolrDocument.new(id: strip_a(id), title_display: title) | |||
url = self[:url_suppl]&.select { |elem| elem.include?(id) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you extract this line to a new method and document what it's doing? And put the .first
call in there too?
320fe42
to
cdc9473
Compare
cdc9473
to
9c3d6fc
Compare
closes #3840