From 89a973f6178e25f7b5a583ecaf85e481c79e36bc Mon Sep 17 00:00:00 2001 From: LaRita Robinson Date: Fri, 5 Apr 2024 15:27:35 -0400 Subject: [PATCH 1/2] Fix solr endpoint default issue https://github.com/samvera/hyku/issues/2177 --- lib/hyrax/solr_service_decorator.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/hyrax/solr_service_decorator.rb b/lib/hyrax/solr_service_decorator.rb index c3a5f8b52..304c0cce5 100644 --- a/lib/hyrax/solr_service_decorator.rb +++ b/lib/hyrax/solr_service_decorator.rb @@ -28,6 +28,11 @@ def reset! Hyrax.index_adapter&.reset! end + + # Override Hyrax SolrService connection method to always use Hyku's connection method. + def connection + SolrEndpoint.new.connection + end end end From 3338cd4255012711dbdf7b99a62afeb451ae80a0 Mon Sep 17 00:00:00 2001 From: LaRita Robinson Date: Fri, 5 Apr 2024 16:50:33 -0400 Subject: [PATCH 2/2] Fix spec --- spec/requests/catalog_controller_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/requests/catalog_controller_spec.rb b/spec/requests/catalog_controller_spec.rb index f4f79b524..5b034b18e 100644 --- a/spec/requests/catalog_controller_spec.rb +++ b/spec/requests/catalog_controller_spec.rb @@ -21,7 +21,7 @@ WebMock.disable! allow(AccountElevator).to receive(:switch!).with(cross_search_tenant_account.cname).and_return('public') allow(Apartment::Tenant.adapter).to receive(:connect_to_new).and_return('') - allow_any_instance_of(Hyrax::SolrService).to receive(:connection).and_return(sample_solr_connection) + allow_any_instance_of(Hyrax::SolrServiceDecorator).to receive(:connection).and_return(sample_solr_connection) Hyrax::SolrService.add(hyku_sample_work.to_solr) Hyrax::SolrService.commit