blacklight 7.14.0 → 7.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -2
- data/VERSION +1 -1
- 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 +36 -17
- data/app/components/blacklight/document/action_component.html.erb +1 -1
- data/app/components/blacklight/document/action_component.rb +2 -1
- data/app/components/blacklight/document/actions_component.html.erb +1 -1
- data/app/components/blacklight/document/actions_component.rb +2 -1
- data/app/components/blacklight/document/thumbnail_component.html.erb +1 -1
- data/app/components/blacklight/document/thumbnail_component.rb +4 -1
- 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/search_bar_component.html.erb +4 -0
- data/app/components/blacklight/search_bar_component.rb +9 -3
- data/app/controllers/concerns/blacklight/bookmarks.rb +1 -1
- data/app/controllers/concerns/blacklight/catalog.rb +7 -1
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +3 -4
- data/app/helpers/blacklight/component_helper_behavior.rb +2 -2
- data/app/helpers/blacklight/configuration_helper_behavior.rb +4 -4
- data/app/helpers/blacklight/facets_helper_behavior.rb +1 -1
- data/app/helpers/blacklight/render_constraints_helper_behavior.rb +2 -2
- 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 +13 -5
- 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/services/blacklight/search_service.rb +1 -1
- 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/_show_main_content.html.erb +2 -2
- data/app/views/catalog/_zero_results.html.erb +1 -1
- data/app/views/catalog/advanced_search.html.erb +17 -0
- data/blacklight.gemspec +1 -1
- data/config/i18n-tasks.yml +1 -0
- data/config/locales/blacklight.en.yml +17 -0
- data/lib/blacklight/configuration.rb +52 -6
- data/lib/blacklight/configuration/field.rb +1 -1
- data/lib/blacklight/configuration/sort_field.rb +1 -1
- data/lib/blacklight/configuration/view_config.rb +16 -5
- data/lib/blacklight/open_struct_with_hash_access.rb +22 -1
- data/lib/blacklight/routes/searchable.rb +1 -0
- data/lib/blacklight/search_builder.rb +2 -0
- data/lib/blacklight/search_state.rb +7 -3
- 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 +98 -24
- data/spec/components/blacklight/advanced_search_form_component_spec.rb +51 -0
- data/spec/components/blacklight/document_component_spec.rb +15 -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/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/lib/blacklight/configuration/view_config_spec.rb +1 -1
- data/spec/lib/blacklight/open_struct_with_hash_access_spec.rb +20 -0
- data/spec/lib/blacklight/search_state/filter_field_spec.rb +65 -0
- data/spec/models/blacklight/configuration_spec.rb +64 -0
- data/spec/models/blacklight/solr/repository_spec.rb +12 -0
- data/spec/models/blacklight/solr/search_builder_spec.rb +60 -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/views/catalog/index.atom.builder_spec.rb +1 -1
- metadata +29 -7
@@ -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: '
|
2
|
+
<%= render(Blacklight::Document::ActionsComponent.new(document: nil, tag: 'div', classes: "#{controller_name}Tools", wrapping_tag: 'span', wrapping_classes: 'btn btn-outline-primary', link_classes: '', 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,
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<% @page_title = t('blacklight.search.show.title', document_title: Deprecation.silence(Blacklight::BlacklightHelperBehavior) { document_show_html_title }, application_name: application_name).html_safe %>
|
4
4
|
<% content_for(:head) { render_link_rel_alternates } %>
|
5
5
|
|
6
|
-
<%= render (blacklight_config.show.document_component || Blacklight::DocumentComponent).new(document: @document, component: :div, title_component: :h1, show: true) do |component| %>
|
6
|
+
<%= render (blacklight_config.view_config(:show).document_component || Blacklight::DocumentComponent).new(document: @document, component: :div, title_component: :h1, show: true) do |component| %>
|
7
7
|
<% component.with(:footer) do %>
|
8
8
|
<% if @document.respond_to?(:export_as_openurl_ctx_kev) %>
|
9
9
|
<!--
|
@@ -17,7 +17,7 @@
|
|
17
17
|
|
18
18
|
<%# Use :body for complete backwards compatibility (overriding the component body markup),
|
19
19
|
but if the app explicitly opted-in to components, make the partials data available as :partials to ease migrations pain %>
|
20
|
-
<% component.with(blacklight_config.show.document_component.blank? && blacklight_config.view_config(:show).partials.any? ? :body : :partials) do %>
|
20
|
+
<% component.with(blacklight_config.view_config(:show).document_component.blank? && blacklight_config.view_config(:show).partials.any? ? :body : :partials) do %>
|
21
21
|
<div id="doc_<%= @document.id.to_s.parameterize %>">
|
22
22
|
<%= render_document_partials @document, blacklight_config.view_config(:show).partials, component: component %>
|
23
23
|
</div>
|
@@ -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,7 +23,7 @@ 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 = '>= 2.
|
26
|
+
s.required_ruby_version = '>= 2.5'
|
27
27
|
|
28
28
|
s.add_dependency "rails", '>= 5.1', '< 7'
|
29
29
|
s.add_dependency "globalid"
|
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'
|
@@ -95,6 +95,12 @@ module Blacklight
|
|
95
95
|
partials: [:show_header, :show],
|
96
96
|
document_actions: NestedOpenStructWithHashAccess.new(ToolConfig)
|
97
97
|
),
|
98
|
+
action_mapping: NestedOpenStructWithHashAccess.new(
|
99
|
+
ViewConfig,
|
100
|
+
default: { top_level_config: :index },
|
101
|
+
show: { top_level_config: :show },
|
102
|
+
citation: { parent_config: :show }
|
103
|
+
),
|
98
104
|
# Configurations for specific types of index views
|
99
105
|
view: NestedOpenStructWithHashAccess.new(ViewConfig,
|
100
106
|
list: {},
|
@@ -132,7 +138,8 @@ module Blacklight
|
|
132
138
|
crawler_detector: nil,
|
133
139
|
autocomplete_suggester: 'mySuggester',
|
134
140
|
raw_endpoint: OpenStructWithHashAccess.new(enabled: false),
|
135
|
-
track_search_session: true
|
141
|
+
track_search_session: true,
|
142
|
+
advanced_search: OpenStruct.new(enabled: false)
|
136
143
|
}
|
137
144
|
end
|
138
145
|
# rubocop:enable Metrics/MethodLength
|
@@ -306,13 +313,35 @@ module Blacklight
|
|
306
313
|
end
|
307
314
|
alias_method :inheritable_copy, :build
|
308
315
|
|
309
|
-
# Get a view configuration for the given view type
|
310
|
-
#
|
316
|
+
# Get a view configuration for the given view type + action. The effective
|
317
|
+
# view configuration is inherited from:
|
318
|
+
# - the configuration from blacklight_config.view with the key `view_type`
|
319
|
+
# - the configuration from blacklight_config.action_mapping with the key `action_name`
|
320
|
+
# - any parent config for the action map result above
|
321
|
+
# - the action_mapping default configuration
|
322
|
+
# - the top-level index/show view configuration
|
323
|
+
#
|
311
324
|
# @param [Symbol,#to_sym] view_type
|
312
325
|
# @return [Blacklight::Configuration::ViewConfig]
|
313
|
-
def view_config(view_type)
|
314
|
-
view_type
|
315
|
-
|
326
|
+
def view_config(view_type = nil, action_name: :index)
|
327
|
+
view_type &&= view_type.to_sym
|
328
|
+
action_name &&= action_name.to_sym
|
329
|
+
action_name ||= :index
|
330
|
+
|
331
|
+
if view_type == :show
|
332
|
+
action_name = view_type
|
333
|
+
view_type = nil
|
334
|
+
end
|
335
|
+
|
336
|
+
@view_config ||= {}
|
337
|
+
@view_config[[view_type, action_name]] ||= begin
|
338
|
+
if view_type.nil?
|
339
|
+
action_config(action_name)
|
340
|
+
else
|
341
|
+
base_config = action_config(action_name)
|
342
|
+
base_config.merge(view.fetch(view_type, {}))
|
343
|
+
end
|
344
|
+
end
|
316
345
|
end
|
317
346
|
|
318
347
|
# YARD will include inline disabling as docs, cannot do multiline inside @!macro. AND this must be separate from doc block.
|
@@ -440,5 +469,22 @@ module Blacklight
|
|
440
469
|
yield(object)
|
441
470
|
end
|
442
471
|
end
|
472
|
+
|
473
|
+
def action_config(action, default: :index)
|
474
|
+
action_config = action_mapping[action]
|
475
|
+
action_config ||= action_mapping[:default]
|
476
|
+
|
477
|
+
if action_config.parent_config && action_config.parent_config != :default
|
478
|
+
parent_config = action_mapping[action_config.parent_config]
|
479
|
+
raise "View configuration error: the parent configuration of #{action_config.key}, #{parent_config.key}, must not specific its own parent configuration" if parent_config.parent_config
|
480
|
+
|
481
|
+
action_config = action_config.reverse_merge(parent_config)
|
482
|
+
end
|
483
|
+
action_config = action_config.reverse_merge(action_mapping[:default]) if action_config != action_mapping[:default]
|
484
|
+
|
485
|
+
action_config = action_config.reverse_merge(self[action_config.top_level_config]) if action_config.top_level_config
|
486
|
+
action_config = action_config.reverse_merge(show) if default == :show && action_config.top_level_config != :show
|
487
|
+
action_config.reverse_merge(index)
|
488
|
+
end
|
443
489
|
end
|
444
490
|
end
|
@@ -17,15 +17,18 @@ class Blacklight::Configuration
|
|
17
17
|
super || Blacklight::SearchBarPresenter
|
18
18
|
end
|
19
19
|
|
20
|
-
def display_label(
|
20
|
+
def display_label(deprecated_key = nil, **options)
|
21
|
+
Deprecation.warn('Passing the key argument to ViewConfig#display_label is deprecated') if deprecated_key.present?
|
22
|
+
|
21
23
|
I18n.t(
|
22
|
-
:"blacklight.search.view_title.#{key}",
|
24
|
+
:"blacklight.search.view_title.#{deprecated_key || key}",
|
23
25
|
default: [
|
24
|
-
:"blacklight.search.view.#{key}",
|
26
|
+
:"blacklight.search.view.#{deprecated_key || key}",
|
25
27
|
label,
|
26
28
|
title,
|
27
|
-
key.to_s.humanize
|
28
|
-
]
|
29
|
+
(deprecated_key || key).to_s.humanize
|
30
|
+
],
|
31
|
+
**options
|
29
32
|
)
|
30
33
|
end
|
31
34
|
|
@@ -38,6 +41,10 @@ class Blacklight::Configuration
|
|
38
41
|
def document_presenter_class
|
39
42
|
super || Blacklight::ShowPresenter
|
40
43
|
end
|
44
|
+
|
45
|
+
def to_h
|
46
|
+
super.merge(document_presenter_class: document_presenter_class)
|
47
|
+
end
|
41
48
|
end
|
42
49
|
|
43
50
|
class Index < ViewConfig
|
@@ -52,6 +59,10 @@ class Blacklight::Configuration
|
|
52
59
|
def document_presenter_class
|
53
60
|
super || Blacklight::IndexPresenter
|
54
61
|
end
|
62
|
+
|
63
|
+
def to_h
|
64
|
+
super.merge(document_presenter_class: document_presenter_class)
|
65
|
+
end
|
55
66
|
end
|
56
67
|
end
|
57
68
|
end
|
@@ -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
|
@@ -42,8 +44,27 @@ module Blacklight
|
|
42
44
|
@table.merge!((other_hash if other_hash.is_a? Hash) || other_hash.to_h)
|
43
45
|
end
|
44
46
|
|
47
|
+
def reverse_merge(other_hash)
|
48
|
+
self.class.new to_h.reverse_merge((other_hash if other_hash.is_a? Hash) || other_hash.to_h)
|
49
|
+
end
|
50
|
+
|
45
51
|
def deep_dup
|
46
52
|
self.class.new @table.deep_dup
|
47
53
|
end
|
54
|
+
|
55
|
+
if Rails.version < '6'
|
56
|
+
# Ported from Rails 6 to fix an incompatibility with ostruct
|
57
|
+
def try(method_name = nil, *args, &block)
|
58
|
+
if method_name.nil? && block_given?
|
59
|
+
if b.arity.zero?
|
60
|
+
instance_eval(&block)
|
61
|
+
else
|
62
|
+
yield self
|
63
|
+
end
|
64
|
+
elsif respond_to?(method_name)
|
65
|
+
public_send(method_name, *args, &b)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
48
69
|
end
|
49
70
|
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
|
@@ -111,9 +115,9 @@ module Blacklight
|
|
111
115
|
# documents
|
112
116
|
def url_for_document(doc, options = {})
|
113
117
|
if respond_to?(:blacklight_config) &&
|
114
|
-
blacklight_config.show.route &&
|
118
|
+
blacklight_config.view_config(:show).route &&
|
115
119
|
(!doc.respond_to?(:to_model) || doc.to_model.is_a?(SolrDocument))
|
116
|
-
route = blacklight_config.show.route.merge(action: :show, id: doc).merge(options)
|
120
|
+
route = blacklight_config.view_config(:show).route.merge(action: :show, id: doc).merge(options)
|
117
121
|
route[:controller] = params[:controller] if route[:controller] == :current
|
118
122
|
route
|
119
123
|
else
|