From 63ff817c272f77e1d8f8a1a38e9206c772ad4c6f Mon Sep 17 00:00:00 2001 From: Jeremy Friesen Date: Wed, 31 Jan 2024 12:23:53 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Favor=20Hyrax::SolrService=20whe?= =?UTF-8?q?re=20possible?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We need one remaining `ActiveFedora::SolrService` reference to tie into that not yet removed class. --- .../hyrax/admin/analytics/work_reports_controller.rb | 8 ++++---- app/models/hyrax/statistic.rb | 2 +- app/services/hyrax/solr_service.rb | 2 +- lib/wings/services/custom_queries/find_ids_by_model.rb | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/controllers/hyrax/admin/analytics/work_reports_controller.rb b/app/controllers/hyrax/admin/analytics/work_reports_controller.rb index b141edbf90..977e80a60c 100644 --- a/app/controllers/hyrax/admin/analytics/work_reports_controller.rb +++ b/app/controllers/hyrax/admin/analytics/work_reports_controller.rb @@ -41,11 +41,11 @@ def show def accessible_works models = Hyrax.config.curation_concerns.map { |m| "\"#{m}\"" } if current_user.ability.admin? - ActiveFedora::SolrService.query("has_model_ssim:(#{models.join(' OR ')})", + Hyrax::SolrService.query("has_model_ssim:(#{models.join(' OR ')})", fl: 'title_tesim, id, member_of_collections', rows: 50_000) else - ActiveFedora::SolrService.query( + Hyrax::SolrService.query( "edit_access_person_ssim:#{current_user} AND has_model_ssim:(#{models.join(' OR ')})", fl: 'title_tesim, id, member_of_collections', rows: 50_000 @@ -55,13 +55,13 @@ def accessible_works def accessible_file_sets if current_user.ability.admin? - ActiveFedora::SolrService.query( + Hyrax::SolrService.query( "has_model_ssim:FileSet", fl: 'title_tesim, id', rows: 50_000 ) else - ActiveFedora::SolrService.query( + Hyrax::SolrService.query( "edit_access_person_ssim:#{current_user} AND has_model_ssim:FileSet", fl: 'title_tesim, id', rows: 50_000 diff --git a/app/models/hyrax/statistic.rb b/app/models/hyrax/statistic.rb index d250597904..488e407b62 100644 --- a/app/models/hyrax/statistic.rb +++ b/app/models/hyrax/statistic.rb @@ -43,7 +43,7 @@ def ga_statistics(start_date, object) def query_works(query) models = Hyrax.config.curation_concerns.map { |m| "\"#{m}\"" } - ActiveFedora::SolrService.query("has_model_ssim:(#{models.join(' OR ')})", fl: query, rows: 100_000) + Hyrax::SolrService.query("has_model_ssim:(#{models.join(' OR ')})", fl: query, rows: 100_000) end def work_types diff --git a/app/services/hyrax/solr_service.rb b/app/services/hyrax/solr_service.rb index 98a8de6b46..5527fe28d2 100644 --- a/app/services/hyrax/solr_service.rb +++ b/app/services/hyrax/solr_service.rb @@ -17,7 +17,7 @@ class SolrService delegate :commit, to: :connection def initialize(use_valkyrie: Hyrax.config.query_index_from_valkyrie) - @old_service = ActiveFedora::SolrService + @old_service = ActiveFedora::SolrService # What hopefully will be the lone reference to ActiveFedora::SolrService @use_valkyrie = use_valkyrie end diff --git a/lib/wings/services/custom_queries/find_ids_by_model.rb b/lib/wings/services/custom_queries/find_ids_by_model.rb index 16f89880f0..86b0ecb64b 100644 --- a/lib/wings/services/custom_queries/find_ids_by_model.rb +++ b/lib/wings/services/custom_queries/find_ids_by_model.rb @@ -29,7 +29,7 @@ def find_ids_by_model(model:, ids: :all) model_name = ModelRegistry.lookup(model).model_name solr_query = "_query_:\"{!raw f=has_model_ssim}#{model_name}\"" - solr_response = ActiveFedora::SolrService.get(solr_query, fl: 'id', rows: @query_rows)['response'] + solr_response = Hyrax::SolrService.get(solr_query, fl: 'id', rows: @query_rows)['response'] loop do response_docs = solr_response['docs'] @@ -38,7 +38,7 @@ def find_ids_by_model(model:, ids: :all) response_docs.each { |doc| yield doc['id'] } break if (solr_response['start'] + solr_response['docs'].count) >= solr_response['numFound'] - solr_response = ActiveFedora::SolrService.get(solr_query, fl: 'id', rows: @query_rows, start: solr_response['start'] + @query_rows)['response'] + solr_response = Hyrax::SolrService.get(solr_query, fl: 'id', rows: @query_rows, start: solr_response['start'] + @query_rows)['response'] end end end