From a8af87c79c0bb35b3e0a9aa0a88b8d6a60980ebf Mon Sep 17 00:00:00 2001 From: Nick Budak Date: Thu, 26 Jan 2023 11:52:28 -0800 Subject: [PATCH] Support querying the configured solr url when indexing This fixes an issue where we try to print the active solr URL when geocombine:index is invoked, but the Indexer doesn't know it, causing Rake to report that the number of arguments is wrong. --- lib/geo_combine/indexer.rb | 4 ++++ lib/tasks/geo_combine.rake | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/geo_combine/indexer.rb b/lib/geo_combine/indexer.rb index 9cec5b0..01d5c3f 100644 --- a/lib/geo_combine/indexer.rb +++ b/lib/geo_combine/indexer.rb @@ -16,6 +16,10 @@ def initialize(solr: GeoCombine::Indexer.solr) @solr = solr end + def solr_url + @solr.options[:url] + end + # Index everything and return the number of docs successfully indexed def index(docs, commit_within: ENV.fetch('SOLR_COMMIT_WITHIN', 5000).to_i) indexed_count = 0 diff --git a/lib/tasks/geo_combine.rake b/lib/tasks/geo_combine.rake index 7c20248..4c4f167 100644 --- a/lib/tasks/geo_combine.rake +++ b/lib/tasks/geo_combine.rake @@ -27,7 +27,7 @@ namespace :geocombine do task :index do harvester = GeoCombine::Harvester.new indexer = GeoCombine::Indexer.new - puts "Indexing #{harvester.ogm_path} into #{indexer.solr.url}" + puts "Indexing #{harvester.ogm_path} into #{indexer.solr_url}" total = indexer.index(harvester.docs_to_index) puts "Indexed #{total} documents" end