Class: Solrizer::Fedora::Indexer

Inherits:
Object
  • Object
show all
Defined in:
lib/solrizer/fedora/indexer.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) connect

This is an override to the base solrizer-fedora connect method in order to update the version of blacklight, which is returning a :url rather than a ‘url’ in the solr_config[:url]



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/solrizer/fedora/indexer.rb', line 11

def connect

  if ActiveFedora.fedora_config.empty?
    ActiveFedora.init
  end

  if defined?(Blacklight)
    solr_config = Blacklight.solr_config
  else
  
    if defined?(RAILS_ROOT)
      config_path = File.join(RAILS_ROOT, "config")
      yaml = YAML.load(File.open(File.join(config_path, "solr.yml")))
      solr_config = yaml[RAILS_ENV]
      puts solr_config.inspect
    else
      config_path = File.join(File.dirname(__FILE__), "..", "..", "..", "config")
      yaml = YAML.load(File.open(File.join(config_path, "solr.yml")))
    
    
      if ENV["environment"].nil?
        environment = "development"
      else
        environment = ENV["environment"]
      end
    
      solr_config = yaml[environment]
      puts solr_config.inspect
    end
  
  end
    
  if index_full_text == true
    url = solr_config['fulltext']['url']
  elsif solr_config.has_key?("default")
    url = solr_config['default']['url']
  elsif solr_config.has_key?('url')
    url = solr_config['url']
  else
    url = solr_config[:url]
  end
  puts "HERE'S WHAT I THINK IS THE SOLR URL -->  #{url}"
  @connection = Solr::Connection.new(url, :autocommit => :on )
end