Skip to content

Commit

Permalink
Merge pull request #96 from scientist-softserv/i765-fix-414-uri-too-l…
Browse files Browse the repository at this point in the history
…ong-error-on-review-submissions-page

Fix 414 URI Too Long error on Review Submissions page
  • Loading branch information
orangewolf authored Dec 14, 2023
2 parents 3235713 + c9243bc commit dd80eb5
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
25 changes: 25 additions & 0 deletions app/services/hyrax/solr_query_service_decorator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# frozen_string_literal: true

# OVERRIDE FILE from Hyrax v3.1.0 - delete after upgrading to Hyrax >= v4.0.0

module Hyrax
# This decorator backports a conceptual fix from Hyrax v4.0.0. It
# prevents a `414 Request-URI Too Long` RSolr error from being
# thrown on the "Review Submissions" page (/admin/workflows).
#
# This is a "conceptual" fix because it is not a line-for-line change
# from Hyrax v4.0.0. Rather, it backports the concept that using
# POST instead of GET allows for larger requests to be sent to Solr.
#
# Reference: https://github.com/samvera/hyrax/issues/5926
module SolrQueryServiceDecorator
##
# @return [Enumerable<SolrDocument>]
def solr_documents
# OVERRIDE: replace #get with solr_service#post
solr_service.post(build)['response']['docs'].map { |doc| self.class.document_model.new(doc) }
end
end
end

Hyrax::SolrQueryService.prepend(Hyrax::SolrQueryServiceDecorator)
7 changes: 7 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,12 @@ class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.

config.to_prepare do
# Allows us to use decorator files
Dir.glob(File.join(File.dirname(__FILE__), '../app/**/*_decorator*.rb')).sort.each do |c|
Rails.configuration.cache_classes ? require(c) : load(c)
end
end
end
end

0 comments on commit dd80eb5

Please sign in to comment.