blacklight 5.15.0 → 5.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/Gemfile +17 -8
- data/VERSION +1 -1
- data/{lib → app/controllers/concerns}/blacklight/base.rb +1 -1
- data/{lib → app/controllers/concerns}/blacklight/bookmarks.rb +0 -0
- data/{lib → app/controllers/concerns}/blacklight/catalog.rb +6 -7
- data/{lib → app/controllers/concerns}/blacklight/controller.rb +6 -0
- data/{lib/blacklight/catalog/component_configuration.rb → app/controllers/concerns/blacklight/default_component_configuration.rb} +5 -2
- data/{lib → app/controllers/concerns}/blacklight/facet.rb +0 -0
- data/{lib → app/controllers/concerns}/blacklight/request_builders.rb +0 -0
- data/{lib/blacklight/catalog → app/controllers/concerns/blacklight}/search_context.rb +1 -2
- data/{lib → app/controllers/concerns}/blacklight/search_fields.rb +0 -6
- data/{lib → app/controllers/concerns}/blacklight/search_helper.rb +4 -4
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +1 -1
- data/app/helpers/blacklight/catalog_helper_behavior.rb +3 -3
- data/app/helpers/blacklight/facets_helper_behavior.rb +4 -5
- data/app/helpers/blacklight/search_history_constraints_helper_behavior.rb +1 -1
- data/{lib → app/models}/blacklight/abstract_repository.rb +0 -0
- data/{lib → app/models}/blacklight/configuration.rb +2 -2
- data/{lib → app/models}/blacklight/configuration/facet_field.rb +0 -0
- data/{lib → app/models}/blacklight/configuration/field.rb +0 -0
- data/{lib → app/models}/blacklight/configuration/fields.rb +1 -1
- data/{lib → app/models}/blacklight/configuration/search_field.rb +0 -0
- data/{lib → app/models}/blacklight/configuration/solr_field.rb +0 -0
- data/{lib → app/models}/blacklight/configuration/sort_field.rb +0 -0
- data/{lib → app/models}/blacklight/configuration/tool_config.rb +0 -0
- data/{lib → app/models}/blacklight/configuration/view_config.rb +0 -0
- data/{lib → app/models}/blacklight/facet_paginator.rb +0 -0
- data/{lib → app/models}/blacklight/search_builder.rb +1 -1
- data/{lib → app/models}/blacklight/solr/facet_paginator.rb +0 -0
- data/{lib/blacklight/solr_repository.rb → app/models/blacklight/solr/repository.rb} +3 -3
- data/{lib → app/models}/blacklight/solr/request.rb +0 -0
- data/{lib/blacklight/solr_response.rb → app/models/blacklight/solr/response.rb} +8 -8
- data/{lib/blacklight/solr_response → app/models/blacklight/solr/response}/facets.rb +8 -8
- data/{lib/blacklight/solr_response → app/models/blacklight/solr/response}/group.rb +2 -2
- data/{lib/blacklight/solr_response → app/models/blacklight/solr/response}/group_response.rb +3 -3
- data/{lib/blacklight/solr_response → app/models/blacklight/solr/response}/more_like_this.rb +1 -1
- data/{lib/blacklight/solr_response → app/models/blacklight/solr/response}/pagination_methods.rb +1 -1
- data/{lib/blacklight/solr_response → app/models/blacklight/solr/response}/response.rb +1 -1
- data/{lib/blacklight/solr_response → app/models/blacklight/solr/response}/spelling.rb +1 -1
- data/{lib → app/models}/blacklight/solr/search_builder.rb +0 -0
- data/{lib → app/models/concerns}/blacklight/configurable.rb +0 -0
- data/{lib → app/models/concerns}/blacklight/document.rb +7 -10
- data/{lib → app/models/concerns}/blacklight/document/active_model_shim.rb +0 -0
- data/{lib → app/models/concerns}/blacklight/document/cache_key.rb +0 -0
- data/{lib → app/models/concerns}/blacklight/document/dublin_core.rb +0 -0
- data/{lib → app/models/concerns}/blacklight/document/email.rb +0 -0
- data/{lib → app/models/concerns}/blacklight/document/export.rb +0 -0
- data/{lib → app/models/concerns}/blacklight/document/extensions.rb +0 -0
- data/{lib → app/models/concerns}/blacklight/document/schema_org.rb +0 -0
- data/{lib → app/models/concerns}/blacklight/document/semantic_fields.rb +0 -0
- data/{lib → app/models/concerns}/blacklight/document/sms.rb +0 -0
- data/{lib → app/models/concerns}/blacklight/solr/document.rb +3 -8
- data/{lib → app/models/concerns}/blacklight/solr/document/dublin_core.rb +0 -0
- data/{lib → app/models/concerns}/blacklight/solr/document/email.rb +0 -0
- data/{lib → app/models/concerns}/blacklight/solr/document/export.rb +0 -0
- data/{lib → app/models/concerns}/blacklight/solr/document/extensions.rb +0 -0
- data/{lib → app/models/concerns}/blacklight/solr/document/more_like_this.rb +0 -0
- data/{lib → app/models/concerns}/blacklight/solr/document/schema_org.rb +0 -0
- data/{lib → app/models/concerns}/blacklight/solr/document/sms.rb +0 -0
- data/{lib → app/models/concerns}/blacklight/solr/search_builder_behavior.rb +6 -1
- data/{lib → app/models/concerns}/blacklight/token_based_user.rb +0 -0
- data/{lib → app/models/concerns}/blacklight/user.rb +0 -0
- data/{lib → app/presenters}/blacklight/document_presenter.rb +0 -0
- data/app/views/catalog/_paginate_compact.html.erb +1 -1
- data/blacklight.gemspec +1 -1
- data/lib/blacklight.rb +7 -32
- data/lib/blacklight/engine.rb +6 -0
- data/lib/blacklight/solr.rb +5 -7
- data/lib/railties/blacklight.rake +3 -1
- data/spec/{lib → controllers}/blacklight/catalog/component_configuration_spec.rb +7 -2
- data/spec/{lib → controllers}/blacklight/facet_spec.rb +0 -0
- data/spec/{lib → controllers}/blacklight/search_fields_spec.rb +2 -2
- data/spec/{lib → controllers}/blacklight/search_helper_spec.rb +3 -3
- data/spec/controllers/catalog_controller_spec.rb +34 -32
- data/spec/controllers/saved_searches_controller_spec.rb +1 -1
- data/spec/helpers/facets_helper_spec.rb +2 -2
- data/spec/helpers/search_history_constraints_helper_spec.rb +23 -3
- data/spec/lib/{utils_spec.rb → blacklight/utils_spec.rb} +0 -0
- data/spec/lib/blacklight_spec.rb +0 -1
- data/spec/{lib → models}/blacklight/configurable_spec.rb +0 -0
- data/spec/{lib → models}/blacklight/configuration_spec.rb +1 -1
- data/spec/{lib → models}/blacklight/document/cache_key_spec.rb +0 -0
- data/spec/{lib → models}/blacklight/document/dublin_core_spec.rb +0 -0
- data/spec/{lib → models}/blacklight/document/email_spec.rb +0 -0
- data/spec/{lib → models}/blacklight/document/sms_spec.rb +0 -0
- data/spec/{lib → models}/blacklight/document_spec.rb +0 -0
- data/spec/{lib → models}/blacklight/facet_paginator_spec.rb +7 -7
- data/spec/{lib → models}/blacklight/search_builder_spec.rb +0 -0
- data/spec/{lib → models}/blacklight/solr/document/more_like_this_spec.rb +0 -0
- data/spec/{lib → models}/blacklight/solr/document_spec.rb +0 -0
- data/spec/{lib → models}/blacklight/solr/facet_paginator_spec.rb +1 -1
- data/spec/{lib/blacklight/solr_repository_spec.rb → models/blacklight/solr/repository_spec.rb} +13 -13
- data/spec/{lib → models}/blacklight/solr/request_spec.rb +0 -0
- data/spec/{lib/blacklight/solr_response → models/blacklight/solr/response}/facets_spec.rb +12 -12
- data/spec/{lib/blacklight/solr_response → models/blacklight/solr/response}/group_response_spec.rb +3 -3
- data/spec/{lib/blacklight/solr_response → models/blacklight/solr/response}/group_spec.rb +2 -2
- data/spec/{lib/blacklight/solr_response_spec.rb → models/blacklight/solr/response_spec.rb} +21 -21
- data/spec/{lib → models}/blacklight/solr/search_builder_spec.rb +0 -0
- data/spec/{lib → models}/blacklight/user_spec.rb +0 -0
- data/spec/{lib → presenters}/document_presenter_spec.rb +0 -0
- data/spec/views/catalog/_facets.html.erb_spec.rb +1 -1
- data/spec/views/catalog/_index_default.erb_spec.rb +10 -10
- data/spec/views/catalog/_show_default.erb_spec.rb +10 -10
- data/spec/views/catalog/_show_sidebar.erb_spec.rb +2 -2
- data/spec/views/catalog/index.atom.builder_spec.rb +30 -33
- metadata +116 -118
- data/spec/support/include_text.rb +0 -20
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7f04052db0293c8e93daad2cd0292fb6f6dd221d
|
|
4
|
+
data.tar.gz: 915bc9c1fc3a1685ac79c0ee68ff19d5a8ab5a62
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 79f8af63d92a6fcc81a8f2381477d7e09ea30e42ed3dd1f1bd34b8fe4d9e1c4baae9831d1169233f4bf4cce41ffd01b5dc5c272f8943f4da63c941bd1e3d0cfb
|
|
7
|
+
data.tar.gz: a0388a293e6791114f1310ec5a83d219746bfd151bc29fc024afa7933ef0c7755ed4d8179c60421c80eab4a43eaf38a0b4489356659d2050b9171d527c28fc4a
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
|
@@ -3,9 +3,7 @@ source 'https://rubygems.org'
|
|
|
3
3
|
# Please see blacklight.gemspec for dependency information.
|
|
4
4
|
gemspec path: File.expand_path('..', __FILE__)
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
# https://github.com/colszowka/simplecov/issues/281
|
|
8
|
-
gem 'simplecov', '~> 0.7.1', require: false
|
|
6
|
+
gem 'simplecov', '~> 0.10', require: false
|
|
9
7
|
gem 'coveralls', require: false
|
|
10
8
|
|
|
11
9
|
group :test do
|
|
@@ -13,14 +11,24 @@ group :test do
|
|
|
13
11
|
gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
|
|
14
12
|
end
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
# BEGIN ENGINE_CART BLOCK
|
|
15
|
+
# engine_cart: 0.8.0
|
|
16
|
+
# engine_cart stanza: 0.8.0
|
|
17
|
+
# the below comes from engine_cart, a gem used to test this Rails engine gem in the context of a Rails app.
|
|
18
|
+
file = File.expand_path("Gemfile", ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path(".internal_test_app", File.dirname(__FILE__)))
|
|
19
|
+
if File.exist?(file)
|
|
20
|
+
begin
|
|
21
|
+
eval_gemfile file
|
|
22
|
+
rescue Bundler::GemfileError => e
|
|
23
|
+
Bundler.ui.warn '[EngineCart] Skipping Rails application dependencies:'
|
|
24
|
+
Bundler.ui.warn e.message
|
|
25
|
+
end
|
|
20
26
|
else
|
|
27
|
+
Bundler.ui.warn "[EngineCart] Unable to find test application dependencies in #{file}, using placeholder dependencies"
|
|
28
|
+
|
|
21
29
|
gem 'rails', ENV['RAILS_VERSION'] if ENV['RAILS_VERSION']
|
|
22
30
|
|
|
23
|
-
if ENV['RAILS_VERSION'].nil? || ENV['RAILS_VERSION']
|
|
31
|
+
if ENV['RAILS_VERSION'].nil? || ENV['RAILS_VERSION'] =~ /^4.2/
|
|
24
32
|
gem 'responders', "~> 2.0"
|
|
25
33
|
gem 'sass-rails', ">= 5.0"
|
|
26
34
|
else
|
|
@@ -28,3 +36,4 @@ else
|
|
|
28
36
|
gem 'sass-rails', "< 5.0"
|
|
29
37
|
end
|
|
30
38
|
end
|
|
39
|
+
# END ENGINE_CART BLOCK
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
5.
|
|
1
|
+
5.16.0
|
|
@@ -5,7 +5,7 @@ module Blacklight::Base
|
|
|
5
5
|
include Blacklight::Configurable
|
|
6
6
|
include Blacklight::SearchHelper
|
|
7
7
|
|
|
8
|
-
include Blacklight::
|
|
8
|
+
include Blacklight::SearchContext
|
|
9
9
|
|
|
10
10
|
included do
|
|
11
11
|
# When Blacklight::Exceptions::InvalidRequest is raised, the rsolr_request_error method is executed.
|
|
File without changes
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
|
2
2
|
module Blacklight::Catalog
|
|
3
3
|
extend ActiveSupport::Concern
|
|
4
|
-
extend ActiveSupport::Autoload
|
|
5
4
|
extend Deprecation
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
autoload :DocumentActions
|
|
10
|
-
autoload :SearchContext
|
|
11
|
-
end
|
|
6
|
+
SearchContext = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('Blacklight::Catalog::SearchContext', 'Blacklight::SearchContext')
|
|
7
|
+
ComponentConfiguration = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('Blacklight::Catalog::ComponentConfiguration', 'Blacklight::DefaultComponentConfiguration')
|
|
12
8
|
|
|
13
9
|
include Blacklight::Base
|
|
14
|
-
include Blacklight::
|
|
10
|
+
include Blacklight::DefaultComponentConfiguration
|
|
15
11
|
include Blacklight::Facet
|
|
16
12
|
|
|
17
13
|
# rubocop:disable Style/ConstantName
|
|
@@ -24,6 +20,8 @@ module Blacklight::Catalog
|
|
|
24
20
|
included do
|
|
25
21
|
helper_method :sms_mappings, :has_search_parameters?
|
|
26
22
|
|
|
23
|
+
helper Blacklight::Facet
|
|
24
|
+
|
|
27
25
|
# When an action raises Blacklight::Exceptions::RecordNotFound, handle
|
|
28
26
|
# the exception appropriately.
|
|
29
27
|
rescue_from Blacklight::Exceptions::RecordNotFound, with: :invalid_document_id_error
|
|
@@ -67,6 +65,7 @@ module Blacklight::Catalog
|
|
|
67
65
|
# updates the search counter (allows the show view to paginate)
|
|
68
66
|
def track
|
|
69
67
|
search_session['counter'] = params[:counter]
|
|
68
|
+
search_session['id'] = params[:search_id]
|
|
70
69
|
search_session['per_page'] = params[:per_page]
|
|
71
70
|
|
|
72
71
|
path = if params[:redirect] and (params[:redirect].starts_with?("/") or params[:redirect] =~ URI::regexp)
|
|
@@ -5,9 +5,14 @@
|
|
|
5
5
|
module Blacklight::Controller
|
|
6
6
|
|
|
7
7
|
extend ActiveSupport::Concern
|
|
8
|
+
extend Deprecation
|
|
9
|
+
|
|
10
|
+
self.deprecation_horizon = 'blacklight 6.0'
|
|
8
11
|
|
|
9
12
|
included do
|
|
10
13
|
include Blacklight::SearchFields
|
|
14
|
+
helper Blacklight::SearchFields
|
|
15
|
+
|
|
11
16
|
include ActiveSupport::Callbacks
|
|
12
17
|
|
|
13
18
|
# now in application.rb file under config.filter_parameters
|
|
@@ -75,6 +80,7 @@ module Blacklight::Controller
|
|
|
75
80
|
def request_is_for_user_resource?
|
|
76
81
|
request.env['PATH_INFO'] =~ /\/?users\/?/
|
|
77
82
|
end
|
|
83
|
+
deprecation_deprecate :request_is_for_user_resource?
|
|
78
84
|
|
|
79
85
|
|
|
80
86
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module Blacklight
|
|
2
|
-
module
|
|
2
|
+
module DefaultComponentConfiguration
|
|
3
3
|
extend ActiveSupport::Concern
|
|
4
4
|
|
|
5
5
|
included do
|
|
@@ -35,6 +35,9 @@ module Blacklight
|
|
|
35
35
|
def add_show_tools_partial name, opts = {}
|
|
36
36
|
blacklight_config.add_show_tools_partial(name, opts)
|
|
37
37
|
|
|
38
|
+
return if method_defined?(name) || opts[:define_method] == false
|
|
39
|
+
|
|
40
|
+
# Define a simple action handler for the tool
|
|
38
41
|
define_method name do
|
|
39
42
|
@response, @documents = action_documents
|
|
40
43
|
|
|
@@ -56,7 +59,7 @@ module Blacklight
|
|
|
56
59
|
format.js { render :layout => false }
|
|
57
60
|
end
|
|
58
61
|
end
|
|
59
|
-
end
|
|
62
|
+
end
|
|
60
63
|
end
|
|
61
64
|
|
|
62
65
|
##
|
|
File without changes
|
|
File without changes
|
|
@@ -26,12 +26,6 @@
|
|
|
26
26
|
#
|
|
27
27
|
##
|
|
28
28
|
module Blacklight::SearchFields
|
|
29
|
-
extend ActiveSupport::Concern
|
|
30
|
-
|
|
31
|
-
included do
|
|
32
|
-
helper Blacklight::SearchFields if respond_to? :helper
|
|
33
|
-
end
|
|
34
|
-
|
|
35
29
|
# Looks up search field config list from blacklight_config[:search_fields], and
|
|
36
30
|
# 'normalizes' all field config hashes using normalize_config method.
|
|
37
31
|
def search_field_list
|
|
@@ -96,7 +96,7 @@ module Blacklight::SearchHelper
|
|
|
96
96
|
# @param [Hash,HashWithIndifferentAccess] user_params ({}) the user provided parameters (e.g. query, facets, sort, etc)
|
|
97
97
|
# @param [List<Symbol] processor_chain a list of filter methods to run
|
|
98
98
|
# @yield [search_builder] optional block yields configured SearchBuilder, caller can modify or create new SearchBuilder to be used. Block should return SearchBuilder to be used.
|
|
99
|
-
# @return [Blacklight::
|
|
99
|
+
# @return [Blacklight::Solr::Response] the solr response object
|
|
100
100
|
def search_results(user_params, search_params_logic)
|
|
101
101
|
builder = search_builder(search_params_logic).with(user_params)
|
|
102
102
|
builder.page(user_params[:page]) if user_params[:page]
|
|
@@ -129,7 +129,7 @@ module Blacklight::SearchHelper
|
|
|
129
129
|
deprecation_deprecate :query_solr
|
|
130
130
|
|
|
131
131
|
# retrieve a document, given the doc id
|
|
132
|
-
# @return [Blacklight::
|
|
132
|
+
# @return [Blacklight::Solr::Response, Blacklight::SolrDocument] the solr response object and the first document
|
|
133
133
|
def fetch(id=nil, extra_controller_params={})
|
|
134
134
|
if id.is_a? Array
|
|
135
135
|
fetch_many(id, params, extra_controller_params)
|
|
@@ -161,7 +161,7 @@ module Blacklight::SearchHelper
|
|
|
161
161
|
|
|
162
162
|
##
|
|
163
163
|
# Get the solr response when retrieving only a single facet field
|
|
164
|
-
# @return [Blacklight::
|
|
164
|
+
# @return [Blacklight::Solr::Response] the solr response
|
|
165
165
|
def get_facet_field_response(facet_field, user_params = params || {}, extra_controller_params = {})
|
|
166
166
|
query = search_builder.with(user_params).facet(facet_field)
|
|
167
167
|
repository.search(query.merge(extra_controller_params))
|
|
@@ -202,7 +202,7 @@ module Blacklight::SearchHelper
|
|
|
202
202
|
deprecation_deprecate :get_single_doc_via_search
|
|
203
203
|
|
|
204
204
|
# Get the previous and next document from a search result
|
|
205
|
-
# @return [Blacklight::
|
|
205
|
+
# @return [Blacklight::Solr::Response, Array<Blacklight::SolrDocument>] the solr response and a list of the first and last document
|
|
206
206
|
def get_previous_and_next_documents_for_search(index, request_params, extra_controller_params={})
|
|
207
207
|
p = previous_and_next_document_params(index)
|
|
208
208
|
|
|
@@ -112,7 +112,7 @@ module Blacklight::BlacklightHelperBehavior
|
|
|
112
112
|
##
|
|
113
113
|
# Determine whether to display spellcheck suggestions
|
|
114
114
|
#
|
|
115
|
-
# @param [Blacklight::
|
|
115
|
+
# @param [Blacklight::Solr::Response] response
|
|
116
116
|
# @return [Boolean]
|
|
117
117
|
def should_show_spellcheck_suggestions? response
|
|
118
118
|
response.total <= spell_check_max and response.spelling.words.size > 0
|
|
@@ -131,7 +131,7 @@ module Blacklight::CatalogHelperBehavior
|
|
|
131
131
|
##
|
|
132
132
|
# Should we display the sort and per page widget?
|
|
133
133
|
#
|
|
134
|
-
# @param [Blacklight::
|
|
134
|
+
# @param [Blacklight::Solr::Response]
|
|
135
135
|
# @return [Boolean]
|
|
136
136
|
def show_sort_and_per_page? response = nil
|
|
137
137
|
response ||= @response
|
|
@@ -141,7 +141,7 @@ module Blacklight::CatalogHelperBehavior
|
|
|
141
141
|
##
|
|
142
142
|
# Should we display the pagination controls?
|
|
143
143
|
#
|
|
144
|
-
# @param [Blacklight::
|
|
144
|
+
# @param [Blacklight::Solr::Response]
|
|
145
145
|
# @return [Boolean]
|
|
146
146
|
def show_pagination? response = nil
|
|
147
147
|
response ||= @response
|
|
@@ -207,7 +207,7 @@ module Blacklight::CatalogHelperBehavior
|
|
|
207
207
|
##
|
|
208
208
|
# Get url parameters to a search within a grouped result set
|
|
209
209
|
#
|
|
210
|
-
# @param [Blacklight::
|
|
210
|
+
# @param [Blacklight::Solr::Response::Group]
|
|
211
211
|
# @return [Hash]
|
|
212
212
|
def add_group_facet_params_and_redirect group
|
|
213
213
|
add_facet_params_and_redirect(group.field, group.key)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
module Blacklight::FacetsHelperBehavior
|
|
2
|
-
|
|
3
2
|
include Blacklight::Facet
|
|
4
3
|
|
|
5
4
|
##
|
|
@@ -31,7 +30,7 @@ module Blacklight::FacetsHelperBehavior
|
|
|
31
30
|
# solr field used for faceting. Can be over-ridden for custom
|
|
32
31
|
# display on a per-facet basis.
|
|
33
32
|
#
|
|
34
|
-
# @param [Blacklight::
|
|
33
|
+
# @param [Blacklight::Solr::Response::Facets::FacetField] display_facet
|
|
35
34
|
# @param [Hash] options parameters to use for rendering the facet limit partial
|
|
36
35
|
# @option options [String] :partial partial to render
|
|
37
36
|
# @option options [String] :layout partial layout to render
|
|
@@ -77,7 +76,7 @@ module Blacklight::FacetsHelperBehavior
|
|
|
77
76
|
#
|
|
78
77
|
# By default, only render facets with items.
|
|
79
78
|
#
|
|
80
|
-
# @param [Blacklight::
|
|
79
|
+
# @param [Blacklight::Solr::Response::Facets::FacetField] display_facet
|
|
81
80
|
# @return [Boolean]
|
|
82
81
|
def should_render_facet? display_facet
|
|
83
82
|
# display when show is nil or true
|
|
@@ -117,7 +116,7 @@ module Blacklight::FacetsHelperBehavior
|
|
|
117
116
|
# partial and catalog/facet expanded list. Will output facet value name as
|
|
118
117
|
# a link to add that to your restrictions, with count in parens.
|
|
119
118
|
#
|
|
120
|
-
# @param [Blacklight::
|
|
119
|
+
# @param [Blacklight::Solr::Response::Facets::FacetField]
|
|
121
120
|
# @param [String] facet item
|
|
122
121
|
# @param [Hash] options
|
|
123
122
|
# @option options [Boolean] :suppress_link display the facet, but don't link to it
|
|
@@ -131,7 +130,7 @@ module Blacklight::FacetsHelperBehavior
|
|
|
131
130
|
|
|
132
131
|
##
|
|
133
132
|
# Where should this facet link to?
|
|
134
|
-
# @param [Blacklight::
|
|
133
|
+
# @param [Blacklight::Solr::Response::Facets::FacetField]
|
|
135
134
|
# @param [String] facet item
|
|
136
135
|
# @return [String]
|
|
137
136
|
def path_for_facet(facet_field, item)
|
|
@@ -32,7 +32,7 @@ module Blacklight::SearchHistoryConstraintsHelperBehavior
|
|
|
32
32
|
return "".html_safe unless params[:f]
|
|
33
33
|
|
|
34
34
|
safe_join(params[:f].collect do |facet_field, value_list|
|
|
35
|
-
render_search_to_s_element(
|
|
35
|
+
render_search_to_s_element(facet_field_label(facet_field),
|
|
36
36
|
safe_join(value_list.collect do |value|
|
|
37
37
|
render_filter_value(value, facet_field)
|
|
38
38
|
end, content_tag(:span, " #{t('blacklight.and')} ", :class =>'filterSeparator'))
|
|
File without changes
|
|
@@ -201,7 +201,7 @@ module Blacklight
|
|
|
201
201
|
end
|
|
202
202
|
|
|
203
203
|
def response_model
|
|
204
|
-
super || Blacklight::
|
|
204
|
+
super || Blacklight::Solr::Response
|
|
205
205
|
end
|
|
206
206
|
alias_method :solr_response_model, :response_model
|
|
207
207
|
# only here to support alias_method
|
|
@@ -212,7 +212,7 @@ module Blacklight
|
|
|
212
212
|
deprecation_deprecate solr_response_model: :response_model, :solr_response_model= => :response_model=
|
|
213
213
|
|
|
214
214
|
def repository_class
|
|
215
|
-
super || Blacklight::
|
|
215
|
+
super || Blacklight::Solr::Repository
|
|
216
216
|
end
|
|
217
217
|
|
|
218
218
|
def connection_config
|
|
File without changes
|
|
File without changes
|
|
@@ -131,7 +131,7 @@ module Blacklight
|
|
|
131
131
|
|
|
132
132
|
@table[:luke_fields] ||= Rails.cache.fetch("blacklight_configuration/admin/luke", expires_in: 1.hour) do
|
|
133
133
|
begin
|
|
134
|
-
if repository_class
|
|
134
|
+
if repository_class <= Blacklight::Solr::Repository
|
|
135
135
|
repository = repository_class.new(self)
|
|
136
136
|
repository.send_and_receive('admin/luke', params: { fl: '*', 'json.nl' => 'map' })['fields']
|
|
137
137
|
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -101,7 +101,7 @@ module Blacklight
|
|
|
101
101
|
|
|
102
102
|
# a solr query method
|
|
103
103
|
# @param [Hash,HashWithIndifferentAccess] extra_controller_params (nil) extra parameters to add to the search
|
|
104
|
-
# @return [Blacklight::
|
|
104
|
+
# @return [Blacklight::Solr::Response] the solr response object
|
|
105
105
|
def to_hash method_extra_params = nil
|
|
106
106
|
unless method_extra_params.nil?
|
|
107
107
|
Deprecation.warn(Blacklight::SearchBuilder, "Calling SearchBuilder#query with extra parameters is deprecated. Use #merge(Hash) instead")
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
module Blacklight
|
|
2
|
-
class
|
|
1
|
+
module Blacklight::Solr
|
|
2
|
+
class Repository < Blacklight::AbstractRepository
|
|
3
3
|
unless defined? RSolr
|
|
4
4
|
Deprecation.warn self, "RSolr should be in your gemfile. Blacklight 6.0 will not load rsolr by default"
|
|
5
5
|
require 'rsolr'
|
|
@@ -37,7 +37,7 @@ module Blacklight
|
|
|
37
37
|
# @param [Hash] parameters for RSolr::Client#send_and_receive
|
|
38
38
|
# @overload find(params)
|
|
39
39
|
# @param [Hash] parameters for RSolr::Client#send_and_receive
|
|
40
|
-
# @return [Blacklight::
|
|
40
|
+
# @return [Blacklight::Solr::Response] the solr response object
|
|
41
41
|
def send_and_receive(path, solr_params = {})
|
|
42
42
|
benchmark("Solr fetch", level: :debug) do
|
|
43
43
|
key = blacklight_config.http_method == :post ? :data : :params
|
|
File without changes
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
class Blacklight::
|
|
1
|
+
class Blacklight::Solr::Response < HashWithIndifferentAccess
|
|
2
2
|
extend Deprecation
|
|
3
3
|
|
|
4
|
-
require 'blacklight/
|
|
4
|
+
require 'blacklight/solr/response/pagination_methods'
|
|
5
5
|
|
|
6
|
-
require 'blacklight/
|
|
7
|
-
require 'blacklight/
|
|
8
|
-
require 'blacklight/
|
|
9
|
-
require 'blacklight/
|
|
10
|
-
autoload :GroupResponse, 'blacklight/
|
|
11
|
-
autoload :Group, 'blacklight/
|
|
6
|
+
require 'blacklight/solr/response/response'
|
|
7
|
+
require 'blacklight/solr/response/spelling'
|
|
8
|
+
require 'blacklight/solr/response/facets'
|
|
9
|
+
require 'blacklight/solr/response/more_like_this'
|
|
10
|
+
autoload :GroupResponse, 'blacklight/solr/response/group_response'
|
|
11
|
+
autoload :Group, 'blacklight/solr/response/group'
|
|
12
12
|
|
|
13
13
|
include PaginationMethods
|
|
14
14
|
include Spelling
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
require 'ostruct'
|
|
2
2
|
|
|
3
|
-
module Blacklight::
|
|
3
|
+
module Blacklight::Solr::Response::Facets
|
|
4
4
|
extend Deprecation
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
# represents a facet value; which is a field value and its hit count
|
|
7
7
|
class FacetItem < OpenStruct
|
|
8
8
|
def initialize *args
|
|
@@ -143,7 +143,7 @@ module Blacklight::SolrResponse::Facets
|
|
|
143
143
|
|
|
144
144
|
##
|
|
145
145
|
# Convert Solr's facet_field response into
|
|
146
|
-
# a hash of Blacklight::
|
|
146
|
+
# a hash of Blacklight::Solr::Response::Facet::FacetField objects
|
|
147
147
|
def facet_field_aggregations
|
|
148
148
|
list_as_hash(facet_fields).each_with_object({}) do |(facet_field_name, values), hash|
|
|
149
149
|
items = []
|
|
@@ -191,16 +191,16 @@ module Blacklight::SolrResponse::Facets
|
|
|
191
191
|
facet_queries.select { |k,v| salient_facet_queries.include?(k) }.reject { |value, hits| hits == 0 }.map do |value,hits|
|
|
192
192
|
salient_fields = facet_field.query.select { |key, val| val[:fq] == value }
|
|
193
193
|
key = ((salient_fields.keys if salient_fields.respond_to? :keys) || salient_fields.first).first
|
|
194
|
-
items << Blacklight::
|
|
194
|
+
items << Blacklight::Solr::Response::Facets::FacetItem.new(value: key, hits: hits, label: facet_field.query[key][:label])
|
|
195
195
|
end
|
|
196
196
|
|
|
197
|
-
hash[field_name] = Blacklight::
|
|
197
|
+
hash[field_name] = Blacklight::Solr::Response::Facets::FacetField.new field_name, items
|
|
198
198
|
end
|
|
199
199
|
end
|
|
200
200
|
|
|
201
201
|
##
|
|
202
202
|
# Convert Solr's facet_pivot response into
|
|
203
|
-
# a hash of Blacklight::
|
|
203
|
+
# a hash of Blacklight::Solr::Response::Facet::FacetField objects
|
|
204
204
|
def facet_pivot_aggregations
|
|
205
205
|
facet_pivot.each_with_object({}) do |(field_name, values), hash|
|
|
206
206
|
items = []
|
|
@@ -211,7 +211,7 @@ module Blacklight::SolrResponse::Facets
|
|
|
211
211
|
if blacklight_config and !blacklight_config.facet_fields[field_name]
|
|
212
212
|
# alias all the possible blacklight config names..
|
|
213
213
|
blacklight_config.facet_fields.select { |k,v| v.pivot and v.pivot.join(",") == field_name }.each do |key, _|
|
|
214
|
-
hash[key] = Blacklight::
|
|
214
|
+
hash[key] = Blacklight::Solr::Response::Facets::FacetField.new key, items
|
|
215
215
|
end
|
|
216
216
|
end
|
|
217
217
|
end
|
|
@@ -226,7 +226,7 @@ module Blacklight::SolrResponse::Facets
|
|
|
226
226
|
items << construct_pivot_field(i, parent_fq.merge({ lst[:field] => lst[:value] }))
|
|
227
227
|
end if lst[:pivot]
|
|
228
228
|
|
|
229
|
-
Blacklight::
|
|
229
|
+
Blacklight::Solr::Response::Facets::FacetItem.new(value: lst[:value], hits: lst[:count], field: lst[:field], items: items, fq: parent_fq)
|
|
230
230
|
end
|
|
231
231
|
|
|
232
232
|
|