blacklight 7.13.2 → 7.15.2
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/.github/workflows/ruby.yml +23 -3
- data/README.md +0 -2
- data/VERSION +1 -1
- data/app/assets/javascripts/blacklight/blacklight.js +4 -2
- data/app/assets/stylesheets/blacklight/_header.scss +0 -5
- data/app/assets/stylesheets/blacklight/_icons.scss +5 -1
- data/app/assets/stylesheets/blacklight/blacklight_defaults.scss +5 -1
- data/app/components/blacklight/advanced_search_form_component.html.erb +46 -0
- data/app/components/blacklight/advanced_search_form_component.rb +75 -0
- data/app/components/blacklight/constraint_component.html.erb +1 -1
- data/app/components/blacklight/constraint_layout_component.html.erb +1 -1
- data/app/components/blacklight/constraints_component.rb +42 -17
- data/app/components/blacklight/document/thumbnail_component.html.erb +2 -2
- data/app/components/blacklight/document/thumbnail_component.rb +5 -2
- data/app/components/blacklight/document_component.rb +7 -2
- data/app/components/blacklight/document_metadata_component.rb +1 -1
- data/app/components/blacklight/facet_field_checkboxes_component.html.erb +23 -0
- data/app/components/blacklight/facet_field_checkboxes_component.rb +24 -0
- data/app/components/blacklight/facet_field_inclusive_constraint_component.html.erb +6 -0
- data/app/components/blacklight/facet_field_inclusive_constraint_component.rb +29 -0
- data/app/components/blacklight/facet_field_list_component.html.erb +1 -0
- data/app/components/blacklight/facet_field_pagination_component.rb +1 -1
- data/app/components/blacklight/facet_item_component.rb +4 -2
- data/app/components/blacklight/hidden_search_state_component.rb +54 -0
- data/app/components/blacklight/search_bar_component.html.erb +4 -0
- data/app/components/blacklight/search_bar_component.rb +4 -2
- data/app/controllers/concerns/blacklight/bookmarks.rb +1 -1
- data/app/controllers/concerns/blacklight/catalog.rb +6 -0
- data/app/helpers/blacklight/component_helper_behavior.rb +1 -1
- data/app/helpers/blacklight/configuration_helper_behavior.rb +2 -2
- data/app/helpers/blacklight/facets_helper_behavior.rb +1 -1
- data/app/helpers/blacklight/hash_as_hidden_fields_helper_behavior.rb +2 -38
- data/app/helpers/blacklight/icon_helper_behavior.rb +1 -1
- data/app/helpers/blacklight/render_constraints_helper_behavior.rb +2 -2
- data/app/javascript/blacklight/button_focus.js +1 -0
- data/app/javascript/blacklight/modal.js +10 -4
- data/app/models/concerns/blacklight/suggest/response.rb +1 -1
- data/app/presenters/blacklight/clause_presenter.rb +37 -0
- data/app/presenters/blacklight/document_presenter.rb +5 -1
- data/app/presenters/blacklight/facet_field_presenter.rb +4 -0
- data/app/presenters/blacklight/facet_grouped_item_presenter.rb +45 -0
- data/app/presenters/blacklight/facet_item_presenter.rb +32 -20
- data/app/presenters/blacklight/field_presenter.rb +1 -1
- data/app/presenters/blacklight/inclusive_facet_item_presenter.rb +16 -0
- data/app/presenters/blacklight/rendering/helper_method.rb +4 -4
- data/app/presenters/blacklight/search_bar_presenter.rb +4 -0
- data/app/views/bookmarks/_tools.html.erb +1 -1
- data/app/views/catalog/_advanced_search_form.html.erb +7 -0
- data/app/views/catalog/_advanced_search_help.html.erb +24 -0
- data/app/views/catalog/_search_form.html.erb +1 -0
- data/app/views/catalog/_zero_results.html.erb +1 -1
- data/app/views/catalog/advanced_search.html.erb +17 -0
- data/blacklight.gemspec +5 -4
- data/config/i18n-tasks.yml +1 -0
- data/config/locales/blacklight.en.yml +17 -0
- data/lib/blacklight/configuration.rb +2 -1
- data/lib/blacklight/configuration/field.rb +1 -1
- data/lib/blacklight/configuration/sort_field.rb +1 -1
- data/lib/blacklight/open_struct_with_hash_access.rb +18 -1
- data/lib/blacklight/routes/searchable.rb +1 -0
- data/lib/blacklight/search_builder.rb +2 -0
- data/lib/blacklight/search_state.rb +5 -1
- data/lib/blacklight/search_state/filter_field.rb +17 -7
- data/lib/blacklight/solr/repository.rb +11 -2
- data/lib/blacklight/solr/search_builder_behavior.rb +87 -23
- data/package.json +1 -1
- data/spec/components/blacklight/advanced_search_form_component_spec.rb +51 -0
- data/spec/components/blacklight/constraint_layout_component_spec.rb +1 -1
- data/spec/components/blacklight/document_component_spec.rb +17 -0
- data/spec/components/blacklight/facet_field_checkboxes_component_spec.rb +55 -0
- data/spec/components/blacklight/facet_field_list_component_spec.rb +39 -4
- data/spec/components/blacklight/hidden_search_state_component_spec.rb +24 -0
- data/spec/controllers/catalog_controller_spec.rb +9 -0
- data/spec/features/advanced_search_spec.rb +67 -0
- data/spec/features/bookmarks_spec.rb +1 -9
- data/spec/features/facets_spec.rb +2 -17
- data/spec/features/search_filters_spec.rb +0 -20
- data/spec/helpers/blacklight/hash_as_hidden_fields_behavior_spec.rb +1 -0
- data/spec/helpers/blacklight/url_helper_behavior_spec.rb +1 -0
- data/spec/lib/blacklight/open_struct_with_hash_access_spec.rb +8 -0
- data/spec/lib/blacklight/search_state/filter_field_spec.rb +65 -0
- data/spec/models/blacklight/solr/repository_spec.rb +12 -0
- data/spec/models/blacklight/solr/response/facets_spec.rb +1 -1
- data/spec/models/blacklight/solr/search_builder_spec.rb +28 -0
- data/spec/presenters/blacklight/clause_presenter_spec.rb +34 -0
- data/spec/presenters/blacklight/document_presenter_spec.rb +13 -0
- data/spec/presenters/blacklight/facet_grouped_item_presenter_spec.rb +41 -0
- data/spec/spec_helper.rb +8 -3
- data/spec/test_app_templates/Gemfile.extra +1 -1
- data/spec/views/catalog/_document.html.erb_spec.rb +1 -0
- data/spec/views/catalog/_thumbnail.html.erb_spec.rb +2 -0
- metadata +66 -27
|
@@ -4,7 +4,7 @@ module Blacklight
|
|
|
4
4
|
class FacetItemPresenter
|
|
5
5
|
attr_reader :facet_item, :facet_config, :view_context, :search_state, :facet_field
|
|
6
6
|
|
|
7
|
-
delegate :
|
|
7
|
+
delegate :key, to: :facet_config
|
|
8
8
|
|
|
9
9
|
def initialize(facet_item, facet_config, view_context, facet_field, search_state = view_context.search_state)
|
|
10
10
|
@facet_item = facet_item
|
|
@@ -14,12 +14,24 @@ module Blacklight
|
|
|
14
14
|
@search_state = search_state
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
+
def hits
|
|
18
|
+
return unless @facet_item.respond_to? :hits
|
|
19
|
+
|
|
20
|
+
@facet_item.hits
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def items
|
|
24
|
+
return unless @facet_item.respond_to? :items
|
|
25
|
+
|
|
26
|
+
@facet_item.items
|
|
27
|
+
end
|
|
28
|
+
|
|
17
29
|
##
|
|
18
30
|
# Check if the query parameters have the given facet field with the
|
|
19
31
|
# given value.
|
|
20
32
|
def selected?
|
|
21
33
|
Deprecation.silence(Blacklight::SearchState) do
|
|
22
|
-
search_state.has_facet? facet_config, value:
|
|
34
|
+
search_state.has_facet? facet_config, value: value
|
|
23
35
|
end
|
|
24
36
|
end
|
|
25
37
|
|
|
@@ -34,21 +46,29 @@ module Blacklight
|
|
|
34
46
|
def label
|
|
35
47
|
return @view_context.facet_display_value(@facet_field, @facet_item) unless @view_context.method(:facet_display_value).owner == Blacklight::FacetsHelperBehavior
|
|
36
48
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
49
|
+
label_value = if facet_item.respond_to? :label
|
|
50
|
+
facet_item.label
|
|
51
|
+
else
|
|
52
|
+
value
|
|
53
|
+
end
|
|
42
54
|
|
|
43
55
|
if facet_config.helper_method
|
|
44
|
-
view_context.public_send(facet_config.helper_method,
|
|
45
|
-
elsif facet_config.query && facet_config.query[
|
|
46
|
-
facet_config.query[
|
|
56
|
+
view_context.public_send(facet_config.helper_method, label_value)
|
|
57
|
+
elsif facet_config.query && facet_config.query[label_value]
|
|
58
|
+
facet_config.query[label_value][:label]
|
|
47
59
|
elsif facet_config.date
|
|
48
60
|
localization_options = facet_config.date == true ? {} : facet_config.date
|
|
49
|
-
I18n.l(Time.zone.parse(
|
|
61
|
+
I18n.l(Time.zone.parse(label_value), **localization_options)
|
|
62
|
+
else
|
|
63
|
+
label_value
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def value
|
|
68
|
+
if facet_item.respond_to? :value
|
|
69
|
+
facet_item.value
|
|
50
70
|
else
|
|
51
|
-
|
|
71
|
+
facet_item
|
|
52
72
|
end
|
|
53
73
|
end
|
|
54
74
|
|
|
@@ -78,14 +98,6 @@ module Blacklight
|
|
|
78
98
|
|
|
79
99
|
private
|
|
80
100
|
|
|
81
|
-
def facet_value
|
|
82
|
-
if facet_item.respond_to? :value
|
|
83
|
-
facet_item.value
|
|
84
|
-
else
|
|
85
|
-
facet_item
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
|
|
89
101
|
def facet_field_presenter
|
|
90
102
|
@facet_field_presenter ||= view_context.facet_field_presenter(facet_config, {})
|
|
91
103
|
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Blacklight
|
|
4
|
+
class InclusiveFacetItemPresenter < Blacklight::FacetItemPresenter
|
|
5
|
+
##
|
|
6
|
+
# Get the displayable version of a facet's value
|
|
7
|
+
#
|
|
8
|
+
# @return [String]
|
|
9
|
+
def label
|
|
10
|
+
view_context.safe_join(
|
|
11
|
+
Array(facet_item).map { |value| Blacklight::FacetGroupedItemPresenter.new(facet_item, value, facet_config, view_context, facet_field, search_state).label },
|
|
12
|
+
view_context.t('blacklight.advanced_search.or_html')
|
|
13
|
+
)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -15,10 +15,10 @@ module Blacklight
|
|
|
15
15
|
|
|
16
16
|
def render_helper
|
|
17
17
|
context.send(config.helper_method,
|
|
18
|
-
options.merge(document: document,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
**options.merge(document: document,
|
|
19
|
+
field: config.field,
|
|
20
|
+
config: config,
|
|
21
|
+
value: values))
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<% if render_show_doc_actions_method_from_blacklight? %>
|
|
2
|
-
<%= render(Blacklight::Document::ActionsComponent.new(document: nil, tag: 'ul', classes: "#{controller_name}Tools nav nav-pills", wrapping_tag: 'li', wrapping_classes: 'nav-item', actions: document_actions(document_list), options: { document_list: @response.documents }, url_opts: Blacklight::Parameters.sanitize(params.to_unsafe_h))) %>
|
|
2
|
+
<%= render(Blacklight::Document::ActionsComponent.new(document: nil, tag: 'ul', classes: "#{controller_name}Tools nav nav-pills", wrapping_tag: 'li', wrapping_classes: 'nav-item', actions: document_actions(document_list, options: { document: nil }), options: { document_list: @response.documents }, url_opts: Blacklight::Parameters.sanitize(params.to_unsafe_h))) %>
|
|
3
3
|
<% else %>
|
|
4
4
|
<% Deprecation.warn(self, '#render_show_doc_actions is deprecated; use ActionComponents instead') %>
|
|
5
5
|
<ul class="<%= controller_name %>Tools nav nav-pills">
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<%= render(Blacklight::AdvancedSearchFormComponent.new(
|
|
2
|
+
url: search_action_url,
|
|
3
|
+
classes: ['advanced', 'form-horizontal'],
|
|
4
|
+
params: search_state.params_for_search.except(:qt),
|
|
5
|
+
search_fields: Deprecation.silence(Blacklight::ConfigurationHelperBehavior) { search_fields },
|
|
6
|
+
response: @response
|
|
7
|
+
)) %>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<div class='card card-default'>
|
|
2
|
+
<div class="card-body">
|
|
3
|
+
<h4 class="card-title">Search tips</h4>
|
|
4
|
+
<ul class="advanced-help">
|
|
5
|
+
<li>Select "match all" to require all fields.
|
|
6
|
+
</li>
|
|
7
|
+
|
|
8
|
+
<li>Select "match any" to find at least one field.
|
|
9
|
+
</li>
|
|
10
|
+
|
|
11
|
+
<li>Combine keywords and attributes to find specific items.
|
|
12
|
+
</li>
|
|
13
|
+
|
|
14
|
+
<li>Use quotation marks to search as a phrase.
|
|
15
|
+
|
|
16
|
+
<li>Use "+" before a term to make it required. (Otherwise results matching only some of your terms may be included).</li>
|
|
17
|
+
|
|
18
|
+
<li>Use "-" before a word or phrase to exclude.
|
|
19
|
+
|
|
20
|
+
<li>Use "OR", "AND", and "NOT" to create complex boolean logic. You can use parentheses in your complex expressions. </li>
|
|
21
|
+
<li>Truncation and wildcards are not supported - word-stemming is done automatically.</li>
|
|
22
|
+
</ul>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<%= render(Blacklight::SearchBarComponent.new(
|
|
2
2
|
url: search_action_url,
|
|
3
|
+
advanced_search_url: search_action_url(action: 'advanced_search'),
|
|
3
4
|
params: search_state.params_for_search.except(:qt),
|
|
4
5
|
search_fields: Deprecation.silence(Blacklight::ConfigurationHelperBehavior) { search_fields },
|
|
5
6
|
presenter: presenter,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<ul>
|
|
5
5
|
<li><%= t 'blacklight.search.zero_results.use_fewer_keywords' %></li>
|
|
6
6
|
|
|
7
|
-
<%- if params[:q] and params[:search_field] and params[:search_field] != blacklight_config.default_search_field
|
|
7
|
+
<%- if params[:q] and params[:search_field] and params[:search_field] != blacklight_config.default_search_field&.key -%>
|
|
8
8
|
<li><%= t 'blacklight.search.zero_results.search_fields', :search_fields => search_field_label(params) %> -
|
|
9
9
|
<%= link_to t('blacklight.search.zero_results.search_everything', field: blacklight_config.default_search_field.label), url_for(search_state.params_for_search(search_field: blacklight_config.default_search_field.key)) %>
|
|
10
10
|
</li>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<% @page_title = t('blacklight.advanced_search.page_title', application_name: application_name) %>
|
|
2
|
+
|
|
3
|
+
<div class="advanced-search-form col-sm-12">
|
|
4
|
+
<h1 class="advanced page-header">
|
|
5
|
+
<%= t('blacklight.advanced_search.form.title') %>
|
|
6
|
+
</h1>
|
|
7
|
+
|
|
8
|
+
<div class="row">
|
|
9
|
+
<div class="col-md-8">
|
|
10
|
+
<%= render 'advanced_search_form' %>
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<div class="col-md-4">
|
|
14
|
+
<%= render "advanced_search_help" %>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
data/blacklight.gemspec
CHANGED
|
@@ -23,22 +23,23 @@ Gem::Specification.new do |s|
|
|
|
23
23
|
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
24
24
|
s.require_paths = ["lib"]
|
|
25
25
|
|
|
26
|
-
s.required_ruby_version = '
|
|
26
|
+
s.required_ruby_version = '>= 2.5'
|
|
27
27
|
|
|
28
28
|
s.add_dependency "rails", '>= 5.1', '< 7'
|
|
29
29
|
s.add_dependency "globalid"
|
|
30
30
|
s.add_dependency "jbuilder", '~> 2.7'
|
|
31
31
|
s.add_dependency "kaminari", ">= 0.15" # the pagination (page 1,2,3, etc..) of our search results
|
|
32
32
|
s.add_dependency "deprecation"
|
|
33
|
-
s.add_dependency "
|
|
33
|
+
s.add_dependency "i18n", '>= 1.7.0' # added named parameters
|
|
34
|
+
s.add_dependency "ostruct", '>= 0.3.2'
|
|
35
|
+
s.add_dependency "view_component", '>= 2.23.0'
|
|
34
36
|
|
|
35
37
|
s.add_development_dependency "rsolr", ">= 1.0.6", "< 3" # Library for interacting with rSolr.
|
|
36
38
|
s.add_development_dependency "rspec-rails", "~> 4.0.0.beta2"
|
|
37
39
|
s.add_development_dependency "rspec-its"
|
|
38
40
|
s.add_development_dependency "rspec-collection_matchers", ">= 1.0"
|
|
39
41
|
s.add_development_dependency "capybara", '~> 3'
|
|
40
|
-
s.add_development_dependency '
|
|
41
|
-
s.add_development_dependency "selenium-webdriver", '>= 3.13.1'
|
|
42
|
+
s.add_development_dependency 'apparition'
|
|
42
43
|
s.add_development_dependency 'engine_cart', '~> 2.1'
|
|
43
44
|
s.add_development_dependency "equivalent-xml"
|
|
44
45
|
s.add_development_dependency "simplecov"
|
data/config/i18n-tasks.yml
CHANGED
|
@@ -239,3 +239,20 @@ en:
|
|
|
239
239
|
main:
|
|
240
240
|
aria:
|
|
241
241
|
main_container: 'Main content'
|
|
242
|
+
|
|
243
|
+
advanced_search:
|
|
244
|
+
or_html: ' OR '
|
|
245
|
+
more_options: More options
|
|
246
|
+
any_of: 'Any of:'
|
|
247
|
+
op:
|
|
248
|
+
must: all
|
|
249
|
+
should: any
|
|
250
|
+
page_title: Advanced search - %{application_name}
|
|
251
|
+
form:
|
|
252
|
+
title: Advanced search
|
|
253
|
+
search_context: Within search
|
|
254
|
+
limit_criteria_heading_html: "<strong>AND</strong> have these attributes"
|
|
255
|
+
query_criteria_heading_html: "Match %{select_menu} of the fields below"
|
|
256
|
+
sort_label: "Sort results by"
|
|
257
|
+
start_over_html: "Start over"
|
|
258
|
+
search_btn_html: 'Search'
|
|
@@ -132,7 +132,8 @@ module Blacklight
|
|
|
132
132
|
crawler_detector: nil,
|
|
133
133
|
autocomplete_suggester: 'mySuggester',
|
|
134
134
|
raw_endpoint: OpenStructWithHashAccess.new(enabled: false),
|
|
135
|
-
track_search_session: true
|
|
135
|
+
track_search_session: true,
|
|
136
|
+
advanced_search: OpenStruct.new(enabled: false)
|
|
136
137
|
}
|
|
137
138
|
end
|
|
138
139
|
# rubocop:enable Metrics/MethodLength
|
|
@@ -4,7 +4,9 @@ module Blacklight
|
|
|
4
4
|
##
|
|
5
5
|
# An OpenStruct that responds to common Hash methods
|
|
6
6
|
class OpenStructWithHashAccess < OpenStruct
|
|
7
|
-
delegate :keys, :each, :map, :has_key?, :key?, :include?, :empty?,
|
|
7
|
+
delegate :keys, :each, :map, :has_key?, :key?, :include?, :empty?,
|
|
8
|
+
:length, :delete, :delete_if, :keep_if, :clear, :reject!, :select!,
|
|
9
|
+
:replace, :fetch, :to_json, :as_json, :any?, to: :to_h
|
|
8
10
|
|
|
9
11
|
##
|
|
10
12
|
# Expose the internal hash
|
|
@@ -45,5 +47,20 @@ module Blacklight
|
|
|
45
47
|
def deep_dup
|
|
46
48
|
self.class.new @table.deep_dup
|
|
47
49
|
end
|
|
50
|
+
|
|
51
|
+
if Rails.version < '6'
|
|
52
|
+
# Ported from Rails 6 to fix an incompatibility with ostruct
|
|
53
|
+
def try(method_name = nil, *args, &block)
|
|
54
|
+
if method_name.nil? && block_given?
|
|
55
|
+
if b.arity.zero?
|
|
56
|
+
instance_eval(&block)
|
|
57
|
+
else
|
|
58
|
+
yield self
|
|
59
|
+
end
|
|
60
|
+
elsif respond_to?(method_name)
|
|
61
|
+
public_send(method_name, *args, &b)
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
48
65
|
end
|
|
49
66
|
end
|
|
@@ -8,6 +8,7 @@ module Blacklight
|
|
|
8
8
|
|
|
9
9
|
def call(mapper, _options = {})
|
|
10
10
|
mapper.match '/', action: 'index', as: 'search', via: [:get, :post]
|
|
11
|
+
mapper.get '/advanced', action: 'advanced_search', as: 'advanced_search'
|
|
11
12
|
|
|
12
13
|
mapper.post ":id/track", action: 'track', as: 'track'
|
|
13
14
|
mapper.get ":id/raw", action: 'raw', as: 'raw', defaults: { format: 'json' }
|
|
@@ -28,6 +28,7 @@ module Blacklight
|
|
|
28
28
|
|
|
29
29
|
@blacklight_params = {}
|
|
30
30
|
@search_state = Blacklight::SearchState.new(@blacklight_params, @scope&.blacklight_config, @scope)
|
|
31
|
+
@additional_filters = {}
|
|
31
32
|
@merged_params = {}
|
|
32
33
|
@reverse_merged_params = {}
|
|
33
34
|
end
|
|
@@ -47,6 +48,7 @@ module Blacklight
|
|
|
47
48
|
params_will_change!
|
|
48
49
|
@search_state = @search_state.reset(@search_state.params.merge(q: conditions))
|
|
49
50
|
@blacklight_params = @search_state.params.dup
|
|
51
|
+
@additional_filters = conditions
|
|
50
52
|
self
|
|
51
53
|
end
|
|
52
54
|
|
|
@@ -82,7 +82,7 @@ module Blacklight
|
|
|
82
82
|
|
|
83
83
|
def has_constraints?
|
|
84
84
|
Deprecation.silence(Blacklight::SearchState) do
|
|
85
|
-
!(query_param.blank? && filter_params.blank? && filters.blank?)
|
|
85
|
+
!(query_param.blank? && filter_params.blank? && filters.blank? && clause_params.blank?)
|
|
86
86
|
end
|
|
87
87
|
end
|
|
88
88
|
|
|
@@ -90,6 +90,10 @@ module Blacklight
|
|
|
90
90
|
params[:q]
|
|
91
91
|
end
|
|
92
92
|
|
|
93
|
+
def clause_params
|
|
94
|
+
params[:clause] || {}
|
|
95
|
+
end
|
|
96
|
+
|
|
93
97
|
def filter_params
|
|
94
98
|
params[:f] || {}
|
|
95
99
|
end
|
|
@@ -36,12 +36,16 @@ module Blacklight
|
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
params = new_state.params
|
|
39
|
+
param = :f
|
|
39
40
|
value = as_url_parameter(item)
|
|
41
|
+
param = :f_inclusive if value.is_a?(Array)
|
|
40
42
|
|
|
41
43
|
# value could be a string
|
|
42
44
|
params[param] = (params[param] || {}).dup
|
|
43
45
|
|
|
44
|
-
if
|
|
46
|
+
if value.is_a? Array
|
|
47
|
+
params[param][key] = value
|
|
48
|
+
elsif config.single
|
|
45
49
|
params[param][key] = [value]
|
|
46
50
|
else
|
|
47
51
|
params[param][key] = Array(params[param][key] || []).dup
|
|
@@ -60,7 +64,10 @@ module Blacklight
|
|
|
60
64
|
end
|
|
61
65
|
|
|
62
66
|
params = new_state.params
|
|
67
|
+
|
|
68
|
+
param = :f
|
|
63
69
|
value = as_url_parameter(item)
|
|
70
|
+
param = :f_inclusive if value.is_a?(Array)
|
|
64
71
|
|
|
65
72
|
# need to dup the facet values too,
|
|
66
73
|
# if the values aren't dup'd, then the values
|
|
@@ -86,7 +93,10 @@ module Blacklight
|
|
|
86
93
|
# @return [Array] an array of applied filters
|
|
87
94
|
def values
|
|
88
95
|
params = search_state.params
|
|
89
|
-
Array(params.dig(
|
|
96
|
+
f = Array(params.dig(:f, key))
|
|
97
|
+
f_inclusive = [params.dig(:f_inclusive, key)] if params.dig(:f_inclusive, key).present?
|
|
98
|
+
|
|
99
|
+
f + (f_inclusive || [])
|
|
90
100
|
end
|
|
91
101
|
delegate :any?, to: :values
|
|
92
102
|
|
|
@@ -100,15 +110,15 @@ module Blacklight
|
|
|
100
110
|
value = as_url_parameter(item)
|
|
101
111
|
params = search_state.params
|
|
102
112
|
|
|
103
|
-
|
|
113
|
+
if value.is_a?(Array)
|
|
114
|
+
(params.dig(:f_inclusive, key) || []).to_set == value.to_set
|
|
115
|
+
else
|
|
116
|
+
(params.dig(:f, key) || []).include?(value)
|
|
117
|
+
end
|
|
104
118
|
end
|
|
105
119
|
|
|
106
120
|
private
|
|
107
121
|
|
|
108
|
-
def param
|
|
109
|
-
:f
|
|
110
|
-
end
|
|
111
|
-
|
|
112
122
|
# TODO: this code is duplicated in Blacklight::FacetsHelperBehavior
|
|
113
123
|
def as_url_parameter(item)
|
|
114
124
|
if item.respond_to? :value
|