Module: Blacklight
- Extended by:
- Deprecation
- Defined in:
- app/services/blacklight/search_service.rb,
lib/blacklight.rb,
lib/blacklight/solr.rb,
lib/blacklight/engine.rb,
lib/blacklight/routes.rb,
lib/blacklight/version.rb,
lib/blacklight/component.rb,
lib/blacklight/exceptions.rb,
lib/blacklight/parameters.rb,
app/models/blacklight/icon.rb,
app/values/blacklight/types.rb,
lib/blacklight/search_state.rb,
lib/blacklight/configuration.rb,
lib/blacklight/search_builder.rb,
lib/blacklight/runtime_registry.rb,
lib/blacklight/routes/exportable.rb,
lib/blacklight/routes/searchable.rb,
lib/blacklight/abstract_repository.rb,
lib/blacklight/configuration/field.rb,
lib/blacklight/configuration/fields.rb,
app/models/blacklight/suggest_search.rb,
lib/blacklight/configuration/context.rb,
app/models/blacklight/facet_paginator.rb,
app/builders/blacklight/action_builder.rb,
app/services/blacklight/field_retriever.rb,
lib/blacklight/configuration/null_field.rb,
lib/blacklight/configuration/show_field.rb,
lib/blacklight/configuration/sort_field.rb,
app/presenters/blacklight/json_presenter.rb,
app/presenters/blacklight/rendering/join.rb,
app/presenters/blacklight/show_presenter.rb,
app/services/blacklight/document_factory.rb,
lib/blacklight/configuration/facet_field.rb,
lib/blacklight/configuration/index_field.rb,
lib/blacklight/configuration/tool_config.rb,
lib/blacklight/search_state/filter_field.rb,
lib/generators/blacklight/solr_generator.rb,
lib/generators/blacklight/user_generator.rb,
app/components/blacklight/facet_component.rb,
app/controllers/concerns/blacklight/facet.rb,
app/presenters/blacklight/field_presenter.rb,
app/presenters/blacklight/index_presenter.rb,
lib/blacklight/configuration/search_field.rb,
app/presenters/blacklight/clause_presenter.rb,
lib/blacklight/configuration/display_field.rb,
lib/generators/blacklight/assets_generator.rb,
lib/generators/blacklight/models_generator.rb,
lib/blacklight/open_struct_with_hash_access.rb,
lib/generators/blacklight/install_generator.rb,
app/components/blacklight/content_areas_shim.rb,
app/components/blacklight/document_component.rb,
app/presenters/blacklight/document_presenter.rb,
app/presenters/blacklight/rendering/pipeline.rb,
lib/generators/blacklight/document_generator.rb,
app/helpers/blacklight/layout_helper_behavior.rb,
app/presenters/blacklight/rendering/microdata.rb,
app/presenters/blacklight/thumbnail_presenter.rb,
app/components/blacklight/constraint_component.rb,
app/components/blacklight/facet_item_component.rb,
app/components/blacklight/search_bar_component.rb,
app/helpers/blacklight/suggest_helper_behavior.rb,
app/presenters/blacklight/facet_item_presenter.rb,
app/presenters/blacklight/rendering/terminator.rb,
app/presenters/blacklight/search_bar_presenter.rb,
lib/generators/blacklight/controller_generator.rb,
app/components/blacklight/constraints_component.rb,
app/components/blacklight/facet_field_component.rb,
app/models/concerns/blacklight/suggest/response.rb,
app/presenters/blacklight/facet_field_presenter.rb,
app/components/blacklight/system/modal_component.rb,
app/helpers/blacklight/component_helper_behavior.rb,
app/services/blacklight/search_params_yaml_coder.rb,
lib/blacklight/deprecations/engine_configuration.rb,
lib/generators/blacklight/test_support_generator.rb,
app/components/blacklight/response/sort_component.rb,
app/presenters/blacklight/rendering/abstract_step.rb,
app/presenters/blacklight/rendering/helper_method.rb,
app/presenters/blacklight/rendering/link_to_facet.rb,
app/components/blacklight/document/group_component.rb,
app/components/blacklight/document_title_component.rb,
app/components/blacklight/metadata_field_component.rb,
app/components/blacklight/search_context_component.rb,
app/controllers/concerns/blacklight/search_history.rb,
app/presenters/blacklight/link_alternate_presenter.rb,
lib/blacklight/nested_open_struct_with_hash_access.rb,
lib/generators/blacklight/search_builder_generator.rb,
app/components/blacklight/document/action_component.rb,
app/components/blacklight/system/dropdown_component.rb,
app/components/blacklight/document/actions_component.rb,
app/components/blacklight/facet_field_list_component.rb,
app/components/blacklight/facet_item_pivot_component.rb,
app/components/blacklight/constraint_layout_component.rb,
app/components/blacklight/document/bookmark_component.rb,
app/components/blacklight/document/citation_component.rb,
app/components/blacklight/document_metadata_component.rb,
app/components/blacklight/start_over_button_component.rb,
app/components/blacklight/document/thumbnail_component.rb,
app/components/blacklight/facet_field_filter_component.rb,
app/components/blacklight/response/view_type_component.rb,
app/presenters/blacklight/facet_grouped_item_presenter.rb,
lib/blacklight/deprecations/search_state_normalization.rb,
app/components/blacklight/hidden_search_state_component.rb,
app/components/blacklight/response/pagination_component.rb,
app/components/blacklight/response/spellcheck_component.rb,
app/components/blacklight/advanced_search_form_component.rb,
app/components/blacklight/response/facet_group_component.rb,
app/components/blacklight/system/flash_message_component.rb,
app/presenters/blacklight/inclusive_facet_item_presenter.rb,
app/components/blacklight/facet_field_no_layout_component.rb,
app/components/blacklight/metadata_field_layout_component.rb,
app/components/blacklight/facet_field_checkboxes_component.rb,
app/components/blacklight/facet_field_pagination_component.rb,
app/components/blacklight/document/more_like_this_component.rb,
app/components/blacklight/response/view_type_button_component.rb,
app/controllers/concerns/blacklight/default_component_configuration.rb,
app/components/blacklight/facet_field_inclusive_constraint_component.rb,
app/components/blacklight/search_history_constraint_layout_component.rb
Overview
Methods added to this helper will be available to all templates in the hosting application
Defined Under Namespace
Modules: Base, BlacklightHelperBehavior, Bookmarks, Catalog, CatalogHelperBehavior, ComponentHelperBehavior, Configurable, ConfigurationHelperBehavior, ContentAreasShim, Controller, DefaultComponentConfiguration, Deprecations, Document, Exceptions, Facet, FacetsHelperBehavior, HashAsHiddenFieldsHelperBehavior, IconHelperBehavior, LayoutHelperBehavior, RenderConstraintsHelperBehavior, RenderPartialsHelperBehavior, Rendering, Response, Routes, SearchContext, SearchFields, SearchHistory, SearchHistoryConstraintsHelperBehavior, Searchable, Solr, Suggest, SuggestHelperBehavior, System, TokenBasedUser, Types, UrlHelperBehavior, User
Classes: AbstractRepository, ActionBuilder, AdvancedSearchFormComponent, Assets, ClausePresenter, Component, Configuration, ConstraintComponent, ConstraintLayoutComponent, ConstraintsComponent, ControllerGenerator, DocumentComponent, DocumentFactory, DocumentGenerator, DocumentMetadataComponent, DocumentPresenter, DocumentTitleComponent, Engine, FacetComponent, FacetFieldCheckboxesComponent, FacetFieldComponent, FacetFieldFilterComponent, FacetFieldInclusiveConstraintComponent, FacetFieldListComponent, FacetFieldNoLayoutComponent, FacetFieldPaginationComponent, FacetFieldPresenter, FacetGroupedItemPresenter, FacetItemComponent, FacetItemPivotComponent, FacetItemPresenter, FacetPaginator, FieldPresenter, FieldRetriever, HiddenSearchStateComponent, Icon, InclusiveFacetItemPresenter, IndexPresenter, Install, JsonPresenter, LinkAlternatePresenter, MetadataFieldComponent, MetadataFieldLayoutComponent, ModelsGenerator, NestedOpenStructWithHashAccess, OpenStructWithHashAccess, Parameters, RuntimeRegistry, SearchBarComponent, SearchBarPresenter, SearchBuilder, SearchBuilderGenerator, SearchContextComponent, SearchHistoryConstraintLayoutComponent, SearchParamsYamlCoder, SearchService, SearchState, ShowPresenter, SolrGenerator, StartOverButtonComponent, SuggestSearch, TestSupport, ThumbnailPresenter, UserGenerator
Constant Summary
collapse
- VERSION =
version
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.blacklight_config_file ⇒ Object
25
26
27
|
# File 'lib/blacklight.rb', line 25
def self.blacklight_config_file
"#{::Rails.root}/config/blacklight.yml"
end
|
.blacklight_yml ⇒ Object
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
# File 'lib/blacklight.rb', line 84
def self.blacklight_yml
require 'erb'
require 'yaml'
return @blacklight_yml if @blacklight_yml
unless File.exist?(blacklight_config_file)
raise "You are missing a configuration file: #{blacklight_config_file}. Have you run \"rails generate blacklight:install\"?"
end
begin
blacklight_erb = ERB.new(IO.read(blacklight_config_file)).result(binding)
rescue StandardError, SyntaxError => e
raise("#{blacklight_config_file} was found, but could not be parsed with ERB. \n#{e.inspect}")
end
begin
@blacklight_yml = if RUBY_VERSION > '2.6'
YAML.safe_load(blacklight_erb, aliases: true)
else
YAML.safe_load(blacklight_erb, [], [], true)
end
rescue => e
raise("#{blacklight_config_file} was found, but could not be parsed.\n#{e.inspect}")
end
if @blacklight_yml.nil? || !@blacklight_yml.is_a?(Hash)
raise("#{blacklight_config_file} was found, but was blank or malformed.\n")
end
@blacklight_yml
end
|
.connection_config ⇒ Object
62
63
64
65
66
67
68
|
# File 'lib/blacklight.rb', line 62
def self.connection_config
Blacklight::RuntimeRegistry.connection_config ||= begin
raise "The #{::Rails.env} environment settings were not found in the blacklight.yml config" unless blacklight_yml[::Rails.env]
blacklight_yml[::Rails.env].symbolize_keys
end
end
|
.connection_config=(value) ⇒ Object
.default_configuration ⇒ Object
The default Blacklight configuration.
.default_index ⇒ Object
The default index connection for the search index
31
32
33
|
# File 'lib/blacklight.rb', line 31
def self.default_index
Blacklight::RuntimeRegistry.connection ||= repository_class.new(default_configuration)
end
|
.default_index=(repository) ⇒ Object
35
36
37
|
# File 'lib/blacklight.rb', line 35
def self.default_index=(repository)
Blacklight::RuntimeRegistry.connection = repository
end
|
.logger ⇒ Object
116
117
118
119
120
|
# File 'lib/blacklight.rb', line 116
def self.logger
@logger ||= begin
::Rails.logger if defined? Rails && Rails.respond_to?(:logger)
end
end
|
.logger=(logger) ⇒ Object
122
123
124
|
# File 'lib/blacklight.rb', line 122
def self.logger= logger
@logger = logger
end
|
.repository_class ⇒ Object
The configured repository class. By convention, this is the class Blacklight::(name of the adapter)::Repository, e.g.
elastic_search => Blacklight::ElasticSearch::Repository
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/blacklight.rb', line 43
def self.repository_class
case connection_config[:adapter]
when 'solr'
Blacklight::Solr::Repository
when /::/
connection_config[:adapter].constantize
else
raise "The value for :adapter was not found in the blacklight.yml config" unless connection_config.key? :adapter
Blacklight.const_get("#{connection_config.fetch(:adapter)}/Repository".classify)
end
end
|
.root ⇒ Object
returns the full path the the blacklight plugin installation
135
136
137
|
# File 'lib/blacklight.rb', line 135
def self.root
@root ||= File.expand_path(File.dirname(File.dirname(__FILE__)))
end
|
.version ⇒ Object
4
5
6
|
# File 'lib/blacklight/version.rb', line 4
def self.version
@version ||= File.read(File.join(File.dirname(__FILE__), '..', '..', 'VERSION')).chomp
end
|
Instance Method Details
#defaults_version ⇒ Object
74
75
76
77
78
79
80
81
82
|
# File 'lib/blacklight.rb', line 74
def defaults_version
@defaults_version ||= blacklight_yml['load_defaults'] ||
(Blacklight::VERSION.starts_with?('7') && '7.10.0') ||
Blacklight::VERSION
@defaults_version == 'latest' ? Blacklight::VERSION : @defaults_version
end
|