Skip to content

Commit

Permalink
Added Blacklight.default_index
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Feb 12, 2015
1 parent 0ec7387 commit aff60d3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions lib/blacklight.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,12 @@ def self.add_routes(router, options = {})
end

def self.solr
Deprecation.warn Blacklight, "Blacklight.solr is deprecated and will be removed in 6.0.0. Use Blacklight::SolrRepository#connection instead", caller
@solr ||= Blacklight::SolrRepository.new(Blacklight::Configuration.new).connection
Deprecation.warn Blacklight, "Blacklight.solr is deprecated and will be removed in 6.0.0. Use Blacklight.default_index.connection instead", caller
default_index.connection
end

def self.default_index
@default_index ||= Blacklight::SolrRepository.new(Blacklight::Configuration.new)
end

def self.solr_config
Expand Down
4 changes: 2 additions & 2 deletions lib/railties/blacklight.rake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace :blacklight do
desc "Put sample data into solr"
task :seed do
docs = YAML::load(File.open(File.join(Blacklight.root, 'solr', 'sample_solr_documents.yml')))
conn = Blacklight::SolrRepository.new(Blacklight::Configuration.new).connection
conn = Blacklight.default_index.connection
conn.add docs
conn.commit
end
Expand All @@ -26,7 +26,7 @@ namespace :blacklight do
errors = 0
verbose = ENV.fetch('VERBOSE', false).present?

conn = Blacklight::SolrRepository.new(Blacklight::Configuration.new).connection
conn = Blacklight.default_index.connection
puts "[#{conn.uri}]"

print " - admin/ping: "
Expand Down

0 comments on commit aff60d3

Please sign in to comment.