Skip to content

Commit

Permalink
Fixes more solr uri issues (#2182)
Browse files Browse the repository at this point in the history
Refs #2177
  • Loading branch information
laritakr authored Apr 12, 2024
1 parent 3213f78 commit bd56d21
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions lib/valkyrie/indexing/solr/indexing_adapter_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
# frozen_string_literal: true

# Override Hyrax v5.0 to avoid incorrect default connection
# Override Hyrax v5.0 to avoid incorrect default connection. Because of the way
# Hyku uses SolrEndpoint, the configuration isn't always appropriate. At times,
# it falls back into the Valkyrie IndexingAdapter instead of Hyrax's, and
# loses the connection.
# TODO: create and initialize a Hyku version of the indexing adapter
module Valkyrie
module Indexing
module Solr
module IndexingAdapterDecorator
##
# @param connection [RSolr::Client] The RSolr connection to index to.
def initialize(connection: ::SolrEndpoint.new.connection)
@connection = connection
end

def default_connection
::SolrEndpoint.new.connection
@connection = ::SolrEndpoint.new.connection
end

def add_documents(*args)
self.connection = default_connection
super(*args)
end
end
end
Expand Down

0 comments on commit bd56d21

Please sign in to comment.