From 54fccb0921e782f0ba4edf86e2ad293458d12714 Mon Sep 17 00:00:00 2001 From: LaRita Robinson Date: Fri, 5 Apr 2024 17:18:17 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20solr=20endpoint=20default?= =?UTF-8?q?=20issue=20(#2179)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix solr endpoint default issue https://github.com/samvera/hyku/issues/2177 * Fix spec --- lib/hyrax/solr_service_decorator.rb | 5 +++++ spec/requests/catalog_controller_spec.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) 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 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