Module: Blacklight

Extended by:
SearchFields
Defined in:
lib/blacklight/facet.rb,
lib/blacklight.rb,
lib/blacklight/utils.rb,
lib/blacklight/engine.rb,
lib/blacklight/routes.rb,
lib/blacklight/version.rb,
lib/blacklight/exceptions.rb,
lib/blacklight/configuration.rb,
lib/blacklight/request_builders.rb,
lib/blacklight/document_presenter.rb,
lib/blacklight/configuration/fields.rb,
lib/blacklight/configuration/sort_field.rb,
lib/blacklight/configuration/solr_field.rb,
lib/blacklight/configuration/facet_field.rb,
lib/blacklight/configuration/search_field.rb,
lib/generators/blacklight/models_generator.rb,
lib/generators/blacklight/assets_generator.rb,
lib/generators/blacklight/install_generator.rb,
lib/generators/blacklight/test_support_generator.rb

Overview

These are methods that are used at both the view helper and controller layers They are only dependent on `blacklight_config` and `@response`

Defined Under Namespace

Modules: Base, BlacklightHelperBehavior, Catalog, CatalogHelperBehavior, Configurable, ConfigurationHelperBehavior, Controller, Exceptions, Facet, FacetsHelperBehavior, HashAsHiddenFieldsHelperBehavior, RenderConstraintsHelperBehavior, RequestBuilders, SearchFields, SearchHistoryConstraintsHelperBehavior, Solr, SolrHelper, UrlHelperBehavior, User Classes: Assets, Configuration, DocumentPresenter, Engine, Install, ModelsGenerator, NestedOpenStructWithHashAccess, OpenStructWithHashAccess, Routes, SolrResponse, TestSupport

Constant Summary

VERSION =
self.version
@@secret_key =
nil

Class Attribute Summary (collapse)

Class Method Summary (collapse)

Methods included from SearchFields

default_search_field, label_for_search_field, search_field_def_for_key, search_field_list

Class Attribute Details

+ (Object) solr

Returns the value of attribute solr



36
37
38
# File 'lib/blacklight.rb', line 36

def solr
  @solr
end

+ (Object) solr_config

Returns the value of attribute solr_config



36
37
38
# File 'lib/blacklight.rb', line 36

def solr_config
  @solr_config
end

Class Method Details

+ (Object) add_routes(router, options = {})



48
49
50
# File 'lib/blacklight.rb', line 48

def self.add_routes(router, options = {})
  Blacklight::Routes.new(router, options).draw
end

+ (Object) logger



91
92
93
# File 'lib/blacklight.rb', line 91

def self.logger
  ::Rails.logger
end

+ (Object) root

returns the full path the the blacklight plugin installation



104
105
106
# File 'lib/blacklight.rb', line 104

def self.root
  @root ||= File.expand_path(File.dirname(File.dirname(__FILE__)))
end

+ (Object) solr_file



44
45
46
# File 'lib/blacklight.rb', line 44

def self.solr_file
  "#{::Rails.root.to_s}/config/solr.yml"
end

+ (Object) solr_yml



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/blacklight.rb', line 63

def self.solr_yml
  require 'erb'
  require 'yaml'

  return @solr_yml if @solr_yml
  unless File.exists?(solr_file)
    raise "You are missing a solr configuration file: #{solr_file}. Have you run \"rails generate blacklight:install\"?"  
  end

  begin
    @solr_erb = ERB.new(IO.read(solr_file)).result(binding)
  rescue Exception => e
    raise("solr.yml was found, but could not be parsed with ERB. \n#{$!.inspect}")
  end

  begin
    @solr_yml = YAML::load(@solr_erb)
  rescue StandardError => e
    raise("solr.yml was found, but could not be parsed.\n")
  end

  if @solr_yml.nil? || !@solr_yml.is_a?(Hash)
    raise("solr.yml was found, but was blank or malformed.\n")
  end

  return @solr_yml
end

+ (Object) version



4
5
6
# File 'lib/blacklight/version.rb', line 4

def self.version
  @version ||= File.read(File.join(File.dirname(__FILE__), '..', '..', 'VERSION')).chomp
end