Skip to content

Commit

Permalink
Set a rows param on file_set query to find parent work so that it won…
Browse files Browse the repository at this point in the history
…'t generate warnings every time
  • Loading branch information
bbpennel committed Nov 13, 2023
1 parent f5ef72f commit c89dd62
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/overrides/presenters/hyrax/file_set_presenter_override.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# frozen_string_literal: true
# https://github.com/samvera/hyrax/blob/v3.4.2/app/presenters/hyrax/file_set_presenter.rb
# [hyc-override] https://github.com/samvera/hyrax/blob/hyrax-v4.0.0/app/presenters/hyrax/file_set_presenter.rb
Hyrax::FileSetPresenter.class_eval do
def fetch_parent_presenter
ids = Hyrax::SolrService.query("{!field f=member_ids_ssim}#{id}", fl: Hyrax.config.id_field)
# [hyc-override] set a rows field to avoid warnings about no rows being explicitly set
ids = Hyrax::SolrService.query("{!field f=member_ids_ssim}#{id}", fl: Hyrax.config.id_field, rows: 10)
.map { |x| x.fetch(Hyrax.config.id_field) }
Hyrax.logger.warn("Couldn't find a parent work for FileSet: #{id}.") if ids.empty?
ids.each do |id|
Expand Down

0 comments on commit c89dd62

Please sign in to comment.