Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

dnoneill
Copy link
Contributor

@dnoneill dnoneill commented Feb 1, 2024

closes #3840

@dnoneill dnoneill force-pushed the 3840-digital-collection-link branch from 3c0017f to 320fe42 Compare February 1, 2024 16:44
@corylown
Copy link
Contributor

corylown commented Feb 1, 2024

@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.

Copy link
Contributor

@jcoyne jcoyne left a 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) %>
Copy link
Contributor

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) }
Copy link
Contributor

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?

@dnoneill dnoneill force-pushed the 3840-digital-collection-link branch from 320fe42 to cdc9473 Compare February 1, 2024 19:08
@dnoneill dnoneill force-pushed the 3840-digital-collection-link branch from cdc9473 to 9c3d6fc Compare February 1, 2024 19:52
@dnoneill dnoneill marked this pull request as draft February 1, 2024 19:54
@dnoneill dnoneill closed this Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't display "Digital collection" link when collection is not released.
3 participants