lib/railties/blacklight.rake in blacklight-5.9.4 vs lib/railties/blacklight.rake in blacklight-5.10.0

- old
+ new

@@ -8,30 +8,39 @@ task :delete_old_searches, [:days_old] => [:environment] do |t, args| args.with_defaults(:days_old => 7) Search.delete_old_searches(args[:days_old].to_i) end - namespace :solr do + namespace :index do desc "Put sample data into solr" task :seed do docs = YAML::load(File.open(File.join(Blacklight.root, 'solr', 'sample_solr_documents.yml'))) - Blacklight.solr.add docs - Blacklight.solr.commit + conn = Blacklight.default_index.connection + conn.add docs + conn.commit end end + namespace :solr do + task :seed do + Deprecation.warn Blacklight, "blacklight:solr:seed is deprecated; use blacklight:index:seed instead" + Rake::Task['blacklight:index:seed'].invoke + end + end + namespace :check do desc "Check the Solr connection and controller configuration" task :solr, [:controller_name] => [:environment] do |_, args| errors = 0 verbose = ENV.fetch('VERBOSE', false).present? - puts "[#{Blacklight.solr.uri}]" + conn = Blacklight.default_index.connection + puts "[#{conn.uri}]" print " - admin/ping: " begin - response = Blacklight.solr.send_and_receive 'admin/ping', {} + response = conn.send_and_receive 'admin/ping', {} puts response['status'] errors += 1 unless response['status'] == "OK" rescue Exception => e errors += 1 puts e.to_s @@ -89,14 +98,14 @@ rescue Exception => e errors += 1 puts e.to_s end - print " - get_solr_response_for_doc_id: " + print " - fetch: " begin doc_id = response.docs.first[SolrDocument.unique_key] - response, doc = controller.get_solr_response_for_doc_id doc_id + response, doc = controller.fetch doc_id if response.header['status'] == 0 and doc puts "OK" else errors += 1