blacklight 6.8.0 → 6.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7659ba5e00f78c03a1a4f10c0b3aa010290f3101
4
- data.tar.gz: eff65628374ba2a260ce76c62a8e6fbcc7eea314
3
+ metadata.gz: 2061ccbc1e4df9ec4a7c1b1f780ea5420a379483
4
+ data.tar.gz: f08c9eac999b9954471352a6d5c1d83f9885a932
5
5
  SHA512:
6
- metadata.gz: e6fc2330aa0cd95b868358e8d4761a88a0eca3bbcc7bf3513b843983ff894f87539f289d453c55fa95122f4a0943860d8c8522969f85ea0ccd50cbeda82513cf
7
- data.tar.gz: c176bbe0a6cbaf3c5eea74a13d644a113e7daf87750be9782303ab36081d15da334d23dff1ca6dc2a8e3885c58efd0dac1ddc419f73db63d3b7fbbec6a443ce2
6
+ metadata.gz: 8708c94876e422d943c9fdada3c5faefa71342a7112e6e2a8ce32b7a82b56be6b18ed74f041773e75594928e69fd30067c74ba65bfd7df1be5190f484113a643
7
+ data.tar.gz: 7ae034c2608744da8b713df542509e87e27380794c2400ef3b90bb829e262fc21895fdb7650b133c89d87b8270987b6afd9804408753be1ad4695c886800703f
data/.jshintrc CHANGED
@@ -1,66 +1,19 @@
1
1
  {
2
- /*
3
- * ENVIRONMENTS
4
- * =================
5
- */
6
-
7
- // Define globals exposed by modern browsers.
8
2
  "browser": true,
9
-
10
- // Define globals exposed by jQuery.
11
3
  "jquery": true,
12
-
13
- // Define globals exposed by Node.js.
14
4
  "node": true,
15
-
16
- // Allow ES6.
17
5
  "esnext": true,
18
-
19
- /*
20
- * ENFORCING OPTIONS
21
- * =================
22
- */
23
-
24
- // Force all variable names to use either camelCase style or UPPER_CASE
25
- // with underscores.
26
6
  "camelcase": true,
27
-
28
- // Prohibit use of == and != in favor of === and !==.
29
7
  "eqeqeq": true,
30
-
31
- // Enforce tab width of 2 spaces.
32
8
  "indent": 2,
33
-
34
- // Prohibit use of a variable before it is defined.
35
9
  "latedef": true,
36
-
37
- // Enforce line length to 80 characters
38
10
  "maxlen": 80,
39
-
40
- // Require capitalized names for constructor functions.
41
11
  "newcap": true,
42
-
43
- // Enforce use of single quotation marks for strings.
44
12
  "quotmark": "single",
45
-
46
- // Enforce placing 'use strict' at the top function scope
47
13
  "strict": true,
48
-
49
- // Prohibit use of explicitly undeclared variables.
50
14
  "undef": true,
51
-
52
- // Warn when variables are defined but never used.
53
15
  "unused": true,
54
-
55
- /*
56
- * RELAXING OPTIONS
57
- * =================
58
- */
59
-
60
- // Suppress warnings about == null comparisons.
61
16
  "eqnull": true,
62
-
63
- // Custom predefined javascript objects that should be defined
64
17
  "predef": [
65
18
  "Blacklight"
66
19
  ]
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.8.0
1
+ 6.9.0
@@ -5,6 +5,9 @@ Blacklight.onLoad(function() {
5
5
 
6
6
  $('[data-autocomplete-enabled="true"]').each(function() {
7
7
  var $el = $(this);
8
+ if($el.hasClass('tt-hint')) {
9
+ return;
10
+ }
8
11
  var suggestUrl = $el.data().autocompletePath;
9
12
 
10
13
  var terms = new Bloodhound({
@@ -67,7 +67,15 @@ module Blacklight::Controller
67
67
 
68
68
  # @return [Blacklight::SearchState] a memoized instance of the parameter state.
69
69
  def search_state
70
- @search_state ||= search_state_class.new(params, blacklight_config)
70
+ @search_state ||= begin
71
+ if search_state_class.instance_method(:initialize).arity == -3
72
+ search_state_class.new(params, blacklight_config, self)
73
+ else
74
+ Deprecation.warn(search_state_class, "The constructor for #{search_state_class} now requires a third argument. " \
75
+ "Invoking it will 2 arguments is deprecated and will be removed in Blacklight 7.")
76
+ search_state_class.new(params, blacklight_config)
77
+ end
78
+ end
71
79
  end
72
80
 
73
81
  # Default route to the search action (used e.g. in global partials). Override this method
@@ -131,7 +139,7 @@ module Blacklight::Controller
131
139
  #
132
140
  def has_user_authentication_provider?
133
141
  respond_to? :current_user
134
- end
142
+ end
135
143
 
136
144
  def require_user_authentication_provider
137
145
  raise ActionController::RoutingError, 'Not Found' unless has_user_authentication_provider?
@@ -159,7 +167,7 @@ module Blacklight::Controller
159
167
  end
160
168
 
161
169
  ##
162
- # To handle failed authorization attempts, redirect the user to the
170
+ # To handle failed authorization attempts, redirect the user to the
163
171
  # login form and persist the current request uri as a parameter
164
172
  def access_denied
165
173
  # send the user home if the access was previously denied by the same
@@ -171,5 +179,4 @@ module Blacklight::Controller
171
179
 
172
180
  redirect_to new_user_session_url(:referer => request.fullpath)
173
181
  end
174
-
175
182
  end
@@ -12,6 +12,12 @@ module Blacklight::CatalogHelperBehavior
12
12
  auto_discovery_link_tag(:atom, feed_link_url('atom', options), title: t('blacklight.search.atom_feed'))
13
13
  end
14
14
 
15
+ # @param [Hash] options
16
+ # @option options :route_set the route scope to use when constructing the link
17
+ def json_api_link_tag(options = {})
18
+ auto_discovery_link_tag(:json, feed_link_url('json', options), type: 'application/json')
19
+ end
20
+
15
21
  ##
16
22
  # Override the Kaminari page_entries_info helper with our own, blacklight-aware
17
23
  # implementation.
@@ -64,14 +64,14 @@ module Blacklight::RenderConstraintsHelperBehavior
64
64
  # @param [Hash] localized_params query parameters
65
65
  # @return [String]
66
66
  def render_constraints_filters(localized_params = params)
67
- return "".html_safe unless localized_params[:f]
68
- path = controller.search_state_class.new(localized_params, blacklight_config)
69
- content = []
70
- localized_params[:f].each_pair do |facet,values|
71
- content << render_filter_element(facet, values, path)
72
- end
67
+ return "".html_safe unless localized_params[:f]
68
+ path = controller.search_state_class.new(localized_params, blacklight_config, controller)
69
+ content = []
70
+ localized_params[:f].each_pair do |facet,values|
71
+ content << render_filter_element(facet, values, path)
72
+ end
73
73
 
74
- safe_join(content.flatten, "\n")
74
+ safe_join(content.flatten, "\n")
75
75
  end
76
76
 
77
77
  ##
@@ -6,6 +6,7 @@
6
6
  <%= render_opensearch_response_metadata %>
7
7
  <%= rss_feed_link_tag %>
8
8
  <%= atom_feed_link_tag %>
9
+ <%= json_api_link_tag %>
9
10
  <% end %>
10
11
 
11
12
  <%= render 'search_header' %>
@@ -4,7 +4,7 @@ xml.OpenSearchDescription(:xmlns=>'http://a9.com/-/spec/opensearch/1.1/') {
4
4
  xml.Description "#{application_name} Search"
5
5
  xml.Image "#{asset_url('favicon.ico')}", :height=>16, :width=>16, :type=>'image/x-icon'
6
6
  xml.Contact
7
- xml.Url :type=>'text/html', :method=>'get', :template=>"#{url_for :controller=>'catalog', :only_path => false}?q={searchTerms}"
8
- xml.Url :type=>'application/rss+xml', :method=>'get', :template=>"#{url_for :controller=>'catalog', :only_path => false}.rss?q={searchTerms}"
7
+ xml.Url :type=>'text/html', :method=>'get', :template=>"#{url_for :controller=>'catalog', :only_path => false}?q={searchTerms}&amp;page={startPage?}"
8
+ xml.Url :type=>'application/rss+xml', :method=>'get', :template=>"#{url_for :controller=>'catalog', :only_path => false}.rss?q={searchTerms}&amp;page={startPage?}"
9
9
  xml.Url :type=>'application/x-suggestions+json', :method=>'get', :template=>"#{url_for :controller=>'catalog',:action => 'opensearch', :format=> 'json', :only_path => false}?q={searchTerms}"
10
10
  }
@@ -38,12 +38,12 @@ Gem::Specification.new do |s|
38
38
  s.add_development_dependency "rspec-rails", "~> 3.5"
39
39
  s.add_development_dependency "rspec-its"
40
40
  s.add_development_dependency "rspec-collection_matchers", ">= 1.0"
41
- s.add_development_dependency "capybara", '~> 2.6.0'
41
+ s.add_development_dependency "capybara", '~> 2.6'
42
42
  s.add_development_dependency "poltergeist"
43
43
  s.add_development_dependency 'engine_cart', '~> 1.0'
44
44
  s.add_development_dependency "equivalent-xml"
45
45
  s.add_development_dependency "coveralls"
46
46
  s.add_development_dependency "simplecov"
47
- s.add_development_dependency "rubocop"
47
+ s.add_development_dependency "rubocop", '~> 0.47.0' # pending release of 0.48.1
48
48
  s.add_development_dependency "rubocop-rspec", '~> 1.8.0'
49
49
  end
@@ -0,0 +1,234 @@
1
+ sq:
2
+ views:
3
+ pagination:
4
+ first: '&laquo; E para'
5
+ last: 'E fundit &raquo;'
6
+ previous: '&laquo; Mbrapa'
7
+ next: 'Tjetra &raquo;'
8
+ truncate: '…'
9
+
10
+ pagination_compact:
11
+ previous: '&laquo; Mbrapa'
12
+ next: 'Tjetra &raquo;'
13
+
14
+ blacklight:
15
+ application_name: 'Blacklight'
16
+
17
+ header_links:
18
+ login: 'Hyr'
19
+ logout: 'Dil'
20
+ bookmarks: 'Memorizimet'
21
+ saved_searches: 'Kërkimet e ruajtura'
22
+ search_history: 'Historia'
23
+
24
+ welcome: 'Mirësevini!'
25
+ and: 'dhe'
26
+ or: 'ose'
27
+
28
+ modal:
29
+ close: "Mbylle"
30
+
31
+ bookmarks:
32
+ title: 'Memorizimet'
33
+ page_title: 'Memorizimet - %{application_name}'
34
+ no_bookmarks: 'Nuk keni memorizime të ruajtura'
35
+ add:
36
+ button: 'Memorizo'
37
+ success:
38
+ one: 'Memorizimi u shtua me sukses.'
39
+ other: 'Memorizimet u shtuan me sukses.'
40
+ failure: 'Na vjen keq, ka pasur një problem gjatë ruajtes së memorizimeve.'
41
+ remove:
42
+ button: 'Fshij memorizimin'
43
+ success: 'Fshrija e memorizimit u krye me sukses'
44
+ failure: 'Na vjen keq, ka pasur një problem gjatë fshirjes së memorizimeve.'
45
+ action_confirm: 'Dëshiron ta fshishë memorizimin?'
46
+ clear:
47
+ action_title: 'Fshij memorizimet'
48
+ action_confirm: "Dëshiron t'i fshishë memorizimet?"
49
+ success: 'Memorizimet u fshinë.'
50
+ failure: 'Na vjen keq, ka pasur një problem gjatë fshirjes së memorizimeve.'
51
+ need_login: 'Ju lutemi kyçuni për të menaxhuar dhe për të parë memorizimet tuaja.'
52
+ list_title: 'Memorizimet e juaja'
53
+ delete: 'Fshije'
54
+
55
+ saved_searches:
56
+ add:
57
+ success: 'Kërkimi u ruajt me sukses.'
58
+ failure: 'Ka pasur një problem gjatë ruajt së kërkimit.'
59
+ remove:
60
+ success: 'Kërkimi i ruajtur u fshi me sukses.'
61
+ failure: 'Ka pasur një problem gjatë fshirjes së kërkimit.'
62
+ clear:
63
+ action_title: 'Fshij Kërkimet E Ruajtura'
64
+ action_confirm: "Dëshiron t'i fshishë kërkimet e ruajtua?"
65
+ success: 'Kërkimet e ruajtua u fshinë'
66
+ failure: 'Ka pasur një problem gjatë fshirjes së kërkimeve.'
67
+ title: 'Kërkimet e ruajtura'
68
+ page_title: 'Kërkimet E Ruajtura - %{application_name}'
69
+ need_login: 'Ju lutemi kyçuni për të menaxhuar dhe për të parë kërkimet e ruajtura.'
70
+ no_searches: 'Nuk keni kerkime të ruajtura'
71
+ list_title: 'Kërkimet e ruajtura'
72
+ delete: 'fshije'
73
+
74
+ search_history:
75
+ clear:
76
+ action_title: 'Fshij Historinë E Kërkimit'
77
+ action_confirm: 'Dëshiron ta fshishë historinë e kërkimit?'
78
+ success: 'Historia e kërkimit u fshi'
79
+ failure: 'Ka pasur një problem gjatë fshirjes së historisë së kërkimit.'
80
+ title: 'Historia e kërkimit'
81
+ page_title: 'Historia e kërkimit - %{application_name}'
82
+ no_history: 'Nuk keni histori të kërkimit'
83
+ recent: 'Kërkimet e fundit'
84
+ forget: 'fshije'
85
+ save: 'ruaje'
86
+
87
+ tools:
88
+ title: 'Veglat'
89
+ citation: 'Citati'
90
+ email: 'Email'
91
+ sms: 'Dërgo SMS'
92
+ clear: 'Fshij'
93
+
94
+ citation:
95
+ mla: 'MLA'
96
+ apa: 'APA'
97
+ chicago: 'Chicago'
98
+
99
+ email:
100
+ form:
101
+ title: 'Dërgo Email'
102
+ to: 'Email:'
103
+ message: 'Mesazhi:'
104
+ submit: 'Dërgo'
105
+ text:
106
+ default_title: 'N/A'
107
+ title: 'Titulli: %{value}'
108
+ author: 'Autori: %{value}'
109
+ format: 'Formati: %{value}'
110
+ language: 'Gjuha: %{value}'
111
+ subject:
112
+ one: 'Item Record: %{title}'
113
+ other: 'Item records'
114
+ url: 'URL: %{url}'
115
+ message: 'Mesazhi: %{message}'
116
+
117
+ success: "Emaili u dëgua"
118
+
119
+ errors:
120
+ to:
121
+ invalid: 'Duhet të shkruash një email adresë valide'
122
+ blank: 'Duhet të shkruash një pranues për të dëguar mesazh'
123
+ sms:
124
+ form:
125
+ title: 'SMS'
126
+ to: 'Numri i telefonit:'
127
+ carrier: 'Operatori'
128
+ carrier_prompt: 'Ju lutemi zgjedheni operatorin'
129
+ submit: 'Dërgo'
130
+ text:
131
+ title: '%{value}'
132
+ author: ' nga %{value}'
133
+ url: 'Link: %{url}'
134
+ success: "SMS-i u dëgua"
135
+ errors:
136
+ to:
137
+ invalid: 'Duhet të shkruash një number telefoni me 10 shifra'
138
+ blank: "Duhet të shkruash një numer telefoni për të dëguar SMS"
139
+ carrier:
140
+ blank: 'Duhet të zgjedheni operatorin'
141
+ invalid: "Duhet të zgjedheni operatorë valid"
142
+
143
+ back_to_search: 'Kthehu te kërkimi'
144
+ back_to_bookmarks: 'Kthehu te memorizimet'
145
+
146
+ search:
147
+ # i18n key 'title' is deprecated and will be removed in Blacklight 6.0
148
+ title: '%{application_name} Rezultatet e kërkimit'
149
+ page_title:
150
+ title: '%{constraints} - %{application_name} Rezultatet e kërkimit'
151
+ constraint: '%{label}: %{value}'
152
+ many_constraint_values: '%{values} zgjedhura'
153
+ search_results_header: 'Kufizimet e kërkimit'
154
+ search_results: 'Rezultatet e kërkimit'
155
+ errors:
156
+ request_error: "Na vjen keq, unë nuk e kuptoj kërkimin tuaj."
157
+ invalid_solr_id: "Na vjen keq, ju keni kërkuar një të dhënë që nuk ekziston."
158
+ per_page:
159
+ label: '%{count}<span class="sr-only"> për faqe</span>'
160
+ button_label: '%{count} për faqe'
161
+ title: 'Numri i rezultateve që do të shfaqen për faqe'
162
+ submit: 'Përditëso'
163
+ sort:
164
+ label: 'Klasifikoj sipas %{field}'
165
+ submit: 'klasifiko rezultatet'
166
+ form:
167
+ search_field:
168
+ label: 'Kërko'
169
+ title: 'Targeted search options'
170
+ post_label: 'për'
171
+ search:
172
+ label: 'kërko për'
173
+ placeholder: 'Kërko...'
174
+ submit: 'Kërko'
175
+ pagination:
176
+ title: 'Navigimi i rezultateteve'
177
+ pagination_info:
178
+ no_items_found: '%{entry_name} nuk u gjet'
179
+ single_item_found: '<strong>1</strong> %{entry_name} u gjet'
180
+ pages:
181
+ one: '<strong>%{start_num}</strong> - <strong>%{end_num}</strong> prej <strong>%{total_num}</strong>'
182
+ other: '<strong>%{start_num}</strong> - <strong>%{end_num}</strong> prej <strong>%{total_num}</strong>'
183
+ entry_pagination_info:
184
+ one: '<strong>1 prej 1</strong>'
185
+ other: '<strong>%{current}</strong> prej <strong>%{total}</strong>'
186
+ documents:
187
+ counter: '%{counter}. '
188
+ facets:
189
+ title: 'Kufizo këkimin'
190
+ clear: 'Fshij filterin'
191
+ sort:
192
+ count: 'Renditja numerike'
193
+ index: 'A-Z Renditja'
194
+ count: '%{number}'
195
+ more_html: 'Më shumë <span class="sr-only">%{field_name}</span> »'
196
+ selected:
197
+ remove: '[fshije]'
198
+ missing: "[Mungon]"
199
+ group:
200
+ more: 'më shumë »'
201
+ filters:
202
+ title: 'Ju keni kërkuar për:'
203
+ label: '%{label}:'
204
+ remove:
205
+ value: 'Fshij kufizimin %{value}'
206
+ label_value: 'Fshij kufizimin %{label}: %{value}'
207
+ start_over: 'Fillo nga e para'
208
+ index:
209
+ label: '%{label}:'
210
+ show:
211
+ title: '%{document_title} - %{application_name}'
212
+ label: '%{label}:'
213
+ rss_feed: 'RSS për rezultatet'
214
+ atom_feed: 'Atom për rezultatet'
215
+ fields:
216
+ default: 'Fjala'
217
+ bookmarks:
218
+ present: "Në memorizime"
219
+ absent: "Memorizo"
220
+ inprogress: "Duke u ruajtur..."
221
+ zero_results:
222
+ title: "Nuk u gjet asnjë rezultat"
223
+ modify_search: "Provo të ndryshosh kërkimin"
224
+ use_fewer_keywords: "Përdorni më pak fjalë kyçe, pastaj filtroni kërkimin tuaj me opcionet në të majtë"
225
+ search_fields: "u kërkuat për %{search_fields}"
226
+ search_everything: "provo të kërkosh çdo gjë"
227
+ view_title: "Shiko rezultatin si: "
228
+ view:
229
+ list: "List"
230
+
231
+ entry_name:
232
+ default: 'entry'
233
+
234
+ did_you_mean: 'A keni menduar: %{options}?'
@@ -6,11 +6,16 @@ module Blacklight
6
6
  attr_reader :blacklight_config # Must be called blacklight_config, because Blacklight::Facet calls blacklight_config.
7
7
  attr_reader :params
8
8
 
9
+ # This method is never accessed in this class, but may be used by subclasses that need
10
+ # to access the url_helpers
11
+ attr_reader :controller
12
+
9
13
  delegate :facet_configuration_for_field, to: :blacklight_config
10
14
 
11
15
  # @param [ActionController::Parameters] params
12
16
  # @param [Blacklight::Config] blacklight_config
13
- def initialize(params, blacklight_config)
17
+ # @param [ApplicationController] controller used for the routing helpers
18
+ def initialize(params, blacklight_config, controller = nil)
14
19
  if params.respond_to?(:to_unsafe_h)
15
20
  # This is the typical (not-ActionView::TestCase) code path.
16
21
  @params = params.to_unsafe_h
@@ -24,6 +29,7 @@ module Blacklight
24
29
  end
25
30
 
26
31
  @blacklight_config = blacklight_config
32
+ @controller = controller
27
33
  end
28
34
 
29
35
  def to_hash
@@ -32,7 +38,7 @@ module Blacklight
32
38
  alias to_h to_hash
33
39
 
34
40
  def reset
35
- self.class.new(ActionController::Parameters.new, blacklight_config)
41
+ self.class.new(ActionController::Parameters.new, blacklight_config, controller)
36
42
  end
37
43
 
38
44
  ##
@@ -120,7 +126,7 @@ module Blacklight
120
126
  # @yield [params] The merged parameters hash before being sanitized
121
127
  def params_for_search(params_to_merge={}, &block)
122
128
  # params hash we'll return
123
- my_params = params.dup.merge(self.class.new(params_to_merge, blacklight_config))
129
+ my_params = params.dup.merge(self.class.new(params_to_merge, blacklight_config, controller))
124
130
 
125
131
  if block_given?
126
132
  yield my_params
@@ -28,44 +28,39 @@ module Blacklight::Solr::Response::Spelling
28
28
  if spellcheck && spellcheck[:suggestions]
29
29
  suggestions = spellcheck[:suggestions]
30
30
  unless suggestions.nil?
31
- # suggestions is an array:
32
- # (query term)
33
- # (hash of term info and term suggestion)
34
- # ...
35
- # (query term)
36
- # (hash of term info and term suggestion)
37
- # 'correctlySpelled'
38
- # true/false
39
- # collation
40
- # (suggestion for collation)
41
- if suggestions.index("correctlySpelled") #if extended results
42
- i_stop = suggestions.index("correctlySpelled")
43
- elsif suggestions.index("collation")
44
- i_stop = suggestions.index("collation")
45
- else
46
- i_stop = suggestions.length
31
+ if suggestions.is_a?(Array)
32
+ # Before solr 6.5 suggestions is an array with the following format:
33
+ # (query term)
34
+ # (hash of term info and term suggestion)
35
+ # ...
36
+ # (query term)
37
+ # (hash of term info and term suggestion)
38
+ # 'correctlySpelled'
39
+ # true/false
40
+ # collation
41
+ # (suggestion for collation)
42
+ # We turn it into a hash here so that it is the same format as in solr 6.5 and later
43
+ suggestions = Hash[*suggestions].except('correctlySpelled', 'collation')
47
44
  end
48
- # step through array in 2s to get info for each term
49
- 0.step(i_stop-1, 2) do |i|
50
- term = suggestions[i]
51
- term_info = suggestions[i+1]
52
- # term_info is a hash:
53
- # numFound =>
54
- # startOffset =>
55
- # endOffset =>
56
- # origFreq =>
57
- # suggestion => [{ frequency =>, word => }] # for extended results
58
- # suggestion => ['word'] # for non-extended results
59
- orig_freq = term_info['origFreq']
60
- if term_info['suggestion'].first.is_a?(Hash) or suggestions.index("correctlySpelled")
61
- word_suggestions << term_info['suggestion'].map do |suggestion|
62
- suggestion['word'] if suggestion['freq'] > orig_freq
63
- end
64
- else
65
- # only extended suggestions have frequency so we just return all suggestions
66
- word_suggestions << term_info['suggestion']
45
+
46
+ suggestions.each do |_, term_info|
47
+ # term_info is a hash:
48
+ # numFound =>
49
+ # startOffset =>
50
+ # endOffset =>
51
+ # origFreq =>
52
+ # suggestion => [{ frequency =>, word => }] # for extended results
53
+ # suggestion => ['word'] # for non-extended results
54
+ orig_freq = term_info['origFreq']
55
+ if term_info['suggestion'].first.is_a?(Hash)
56
+ word_suggestions << term_info['suggestion'].map do |suggestion|
57
+ suggestion['word'] if suggestion['freq'] > orig_freq
67
58
  end
59
+ else
60
+ # only extended suggestions have frequency so we just return all suggestions
61
+ word_suggestions << term_info['suggestion']
68
62
  end
63
+ end
69
64
  end
70
65
  end
71
66
  word_suggestions.flatten.compact.uniq
@@ -25,7 +25,7 @@ module Blacklight
25
25
  end
26
26
 
27
27
  def add_rsolr_gem
28
- gem "rsolr".dup, "~> 1.0"
28
+ gem "rsolr".dup, '>= 1.0', '< 3'
29
29
  end
30
30
  end
31
31
  end
@@ -31,7 +31,7 @@ module Blacklight
31
31
  end
32
32
 
33
33
  def add_rsolr_gem
34
- gem 'rsolr', '~> 1.0'
34
+ gem 'rsolr', '>= 1.0', '< 3'
35
35
  end
36
36
  end
37
37
  end
@@ -30,6 +30,7 @@ describe "Search Page" do
30
30
  Capybara.ignore_hidden_elements = false
31
31
  expect(page).to have_selector("link[rel=alternate][type='application/rss+xml']")
32
32
  expect(page).to have_selector("link[rel=alternate][type='application/atom+xml']")
33
+ expect(page).to have_selector("link[rel=alternate][type='application/json']")
33
34
 
34
35
  # opensearch
35
36
  expect(page).to have_selector("meta[name=totalResults]")
@@ -134,7 +134,7 @@ describe CatalogHelper do
134
134
  let(:my_engine) { double("Engine") }
135
135
  let(:query_params) { { controller: 'catalog', action: 'index' } }
136
136
  let(:config) { Blacklight::Configuration.new }
137
- let(:search_state) { Blacklight::SearchState.new(query_params, config) }
137
+ let(:search_state) { Blacklight::SearchState.new(query_params, config, controller) }
138
138
 
139
139
  it "calls url_for on the engine scope" do
140
140
  allow(helper).to receive(:search_state).and_return search_state
@@ -152,7 +152,7 @@ describe CatalogHelper do
152
152
  let(:my_engine) { double("Engine") }
153
153
  let(:query_params) { { controller: 'catalog', action: 'index' } }
154
154
  let(:config) { Blacklight::Configuration.new }
155
- let(:search_state) { Blacklight::SearchState.new(query_params, config) }
155
+ let(:search_state) { Blacklight::SearchState.new(query_params, config, controller) }
156
156
 
157
157
  it "calls url_for on the engine scope" do
158
158
  allow(helper).to receive(:search_state).and_return search_state
@@ -1,23 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- describe HashAsHiddenFieldsHelper do
4
- include HashAsHiddenFieldsHelper
5
- before(:each) do
6
- @hash = {:q => "query", :search_field => "search_field", :per_page=>10, :page=>5, :extra_arbitrary_key=>"arbitrary_value", :f=> {:field1 => ["a", "b"], :field2=> ["z"]}}
3
+ describe Blacklight::HashAsHiddenFieldsHelperBehavior do
4
+ let(:params) do
5
+ { q: "query",
6
+ search_field: "search_field",
7
+ per_page: 10,
8
+ page: 5,
9
+ extra_arbitrary_key: "arbitrary_value",
10
+ f: { field1: %w(a b), field2: ["z"] } }
7
11
  end
12
+ let(:generated) { helper.render_hash_as_hidden_fields(params) }
8
13
 
9
14
  it "converts a hash with nested complex data to Rails-style hidden form fields" do
10
-
11
- generated = render_hash_as_hidden_fields(@hash)
12
-
13
- expect(generated).to have_selector("input[type='hidden'][name='q'][value='query']")
14
- expect(generated).to have_selector("input[type='hidden'][name='per_page'][value='10']")
15
- expect(generated).to have_selector("input[type='hidden'][name='page'][value='5']")
16
- expect(generated).to have_selector("input[type='hidden'][name='extra_arbitrary_key'][value='arbitrary_value']")
17
- expect(generated).to have_selector("input[type='hidden'][name='f[field2][]'][value='z']")
18
- expect(generated).to have_selector("input[type='hidden'][name='f[field1][]'][value='a']")
19
- expect(generated).to have_selector("input[type='hidden'][name='f[field1][]'][value='b']")
20
-
15
+ expect(generated).to have_selector("input[type='hidden'][name='q'][value='query']", visible: false)
16
+ expect(generated).to have_selector("input[type='hidden'][name='per_page'][value='10']", visible: false)
17
+ expect(generated).to have_selector("input[type='hidden'][name='page'][value='5']", visible: false)
18
+ expect(generated).to have_selector("input[type='hidden'][name='extra_arbitrary_key'][value='arbitrary_value']", visible: false)
19
+ expect(generated).to have_selector("input[type='hidden'][name='f[field2][]'][value='z']", visible: false)
20
+ expect(generated).to have_selector("input[type='hidden'][name='f[field1][]'][value='a']", visible: false)
21
+ expect(generated).to have_selector("input[type='hidden'][name='f[field1][]'][value='b']", visible: false)
21
22
  end
22
-
23
23
  end
@@ -50,7 +50,7 @@ describe RenderConstraintsHelper do
50
50
  subject { helper.render_filter_element('type', ['journal'], path) }
51
51
 
52
52
  let(:params) { ActionController::Parameters.new q: 'biz' }
53
- let(:path) { Blacklight::SearchState.new(params, config) }
53
+ let(:path) { Blacklight::SearchState.new(params, config, controller) }
54
54
 
55
55
  it "has a link relative to the current url" do
56
56
  expect(subject).to have_link "Remove constraint Item Type: journal", href: "/catalog?q=biz"
@@ -9,7 +9,8 @@ describe Blacklight::SearchState do
9
9
  end
10
10
 
11
11
  let(:parameter_class) { ActionController::Parameters }
12
- let(:search_state) { described_class.new(params, blacklight_config) }
12
+ let(:controller) { double }
13
+ let(:search_state) { described_class.new(params, blacklight_config, controller) }
13
14
  let(:params) { parameter_class.new }
14
15
 
15
16
  describe '#to_h' do
@@ -1,14 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- describe Blacklight::Solr::Response do
3
+ RSpec.describe Blacklight::Solr::Response do
4
+ let(:raw_response) { eval(mock_query_response) }
4
5
 
5
- def create_response
6
- raw_response = eval(mock_query_response)
7
- Blacklight::Solr::Response.new(raw_response, raw_response['params'])
6
+ let(:r) do
7
+ Blacklight::Solr::Response.new(raw_response,
8
+ raw_response['params'])
8
9
  end
9
10
 
10
- let(:r) { create_response }
11
-
12
11
  it 'should create a valid response' do
13
12
  expect(r).to respond_to(:header)
14
13
  end
@@ -106,7 +105,6 @@ describe Blacklight::Solr::Response do
106
105
  end
107
106
 
108
107
  it 'should return the correct value when calling facet_by_field_name' do
109
- r = create_response
110
108
  facet = r.aggregations['cat']
111
109
  expect(facet.name).to eq 'cat'
112
110
  end
@@ -183,6 +181,15 @@ describe Blacklight::Solr::Response do
183
181
  end
184
182
  end
185
183
 
184
+ context 'solr 6.5 spellcheck collation syntax' do
185
+ it 'should provide spelling suggestions for a regular spellcheck results with a collation' do
186
+ raw_response = eval(mock_response_with_spellcheck_collation_solr65)
187
+ r = Blacklight::Solr::Response.new(raw_response, {})
188
+ expect(r.spelling.words).to include("dell")
189
+ expect(r.spelling.words).to include("ultrasharp")
190
+ end
191
+ end
192
+
186
193
  it "should provide MoreLikeThis suggestions" do
187
194
  raw_response = eval(mock_response_with_more_like_this)
188
195
  r = Blacklight::Solr::Response.new(raw_response, {})
@@ -228,7 +235,11 @@ describe Blacklight::Solr::Response do
228
235
  def mock_response_with_spellcheck_collation_solr5
229
236
  %|{'responseHeader'=>{'status'=>0,'QTime'=>3,'params'=>{'spellspellcheck.build'=>'true','spellcheck'=>'true','q'=>'hell','spellcheck.q'=>'hell ultrashar','wt'=>'ruby','spellcheck.collate'=>'true'}},'response'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'spellcheck'=>{'suggestions'=>['hell',{'numFound'=>1,'startOffset'=>0,'endOffset'=>4,'suggestion'=>['dell']},'ultrashar',{'numFound'=>1,'startOffset'=>5,'endOffset'=>14,'suggestion'=>['ultrasharp']}],'collations'=>['collation','dell ultrasharp']}}|
230
237
  end
231
-
238
+
239
+ def mock_response_with_spellcheck_collation_solr65
240
+ %|{'responseHeader'=>{'status'=>0,'QTime'=>3,'params'=>{'spellspellcheck.build'=>'true','spellcheck'=>'true','q'=>'hell','spellcheck.q'=>'hell ultrashar','wt'=>'ruby','spellcheck.collate'=>'true'}},'response'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'spellcheck'=>{'suggestions'=>{'hell'=>{'numFound'=>1,'startOffset'=>0,'endOffset'=>4,'suggestion'=>['dell']},'ultrashar'=>{'numFound'=>1,'startOffset'=>5,'endOffset'=>14,'suggestion'=>['ultrasharp']}},'collations'=>['collation','dell ultrasharp']}}|
241
+ end
242
+
232
243
  def mock_response_with_more_like_this
233
244
  %({'responseHeader'=>{'status'=>0,'QTime'=>8,'params'=>{'facet'=>'false','mlt.mindf'=>'1','mlt.fl'=>'subject_t','fl'=>'id','mlt.count'=>'3','mlt.mintf'=>'0','mlt'=>'true','q.alt'=>'*:*','qt'=>'search','wt'=>'ruby'}},'response'=>{'numFound'=>30,'start'=>0,'docs'=>[{'id'=>'00282214'},{'id'=>'00282371'},{'id'=>'00313831'},{'id'=>'00314247'},{'id'=>'43037890'},{'id'=>'53029833'},{'id'=>'77826928'},{'id'=>'78908283'},{'id'=>'79930185'},{'id'=>'85910001'}]},'moreLikeThis'=>{'00282214'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'00282371'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'00313831'=>{'numFound'=>1,'start'=>0,'docs'=>[{'id'=>'96933325'}]},'00314247'=>{'numFound'=>3,'start'=>0,'docs'=>[{'id'=>'2008543486'},{'id'=>'96933325'},{'id'=>'2009373513'}]},'43037890'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'53029833'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'77826928'=>{'numFound'=>1,'start'=>0,'docs'=>[{'id'=>'94120425'}]},'78908283'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'79930185'=>{'numFound'=>2,'start'=>0,'docs'=>[{'id'=>'94120425'},{'id'=>'2007020969'}]},'85910001'=>{'numFound'=>0,'start'=>0,'docs'=>[]}}})
234
245
  end
@@ -1,31 +1,27 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- describe SolrDocument do
4
-
5
- before(:each) do
6
-
7
- @solrdoc = SolrDocument.new :id => '00282214', :format => ['Book'], :title_display => 'some-title'
8
-
9
- end
10
-
11
- describe "new" do
12
- it "takes a Hash as the argument" do
13
- expect { SolrDocument.new(:id => 1) }.not_to raise_error
14
- end
15
- end
16
-
3
+ RSpec.describe SolrDocument do
17
4
  describe "access methods" do
18
-
19
- it "has the right value for title_display" do
20
- expect(@solrdoc[:title_display]).not_to be_nil
5
+ let(:solrdoc) do
6
+ SolrDocument.new(id: '00282214', format: ['Book'], title_display: 'some-title')
21
7
  end
22
-
23
- it "has the right value for format" do
24
- expect(@solrdoc[:format][0]).to eq 'Book'
8
+
9
+ describe "#[]" do
10
+ subject { solrdoc[field] }
11
+
12
+ context "with title_display" do
13
+ let(:field) { :title_display }
14
+ it { is_expected.to eq 'some-title' }
15
+ end
16
+ context "with format" do
17
+ let(:field) { :format }
18
+ it { is_expected.to eq ['Book'] }
19
+ end
25
20
  end
26
21
 
27
- it "provides the item's solr id" do
28
- expect(@solrdoc.id).to eq '00282214'
22
+ describe "#id" do
23
+ subject { solrdoc.id }
24
+ it { is_expected.to eq '00282214' }
29
25
  end
30
26
  end
31
- end
27
+ end
@@ -8,7 +8,8 @@ RSpec.describe Blacklight::LinkAlternatePresenter do
8
8
  let(:config) { Blacklight::Configuration.new }
9
9
  let(:parameter_class) { ActionController::Parameters }
10
10
  let(:params) { parameter_class.new }
11
- let(:search_state) { Blacklight::SearchState.new(params, config) }
11
+ let(:controller) { double }
12
+ let(:search_state) { Blacklight::SearchState.new(params, config, controller) }
12
13
 
13
14
  let(:presenter) { described_class.new(view_context, document, options) }
14
15
  before do
@@ -9,7 +9,8 @@ describe Blacklight::IndexPresenter do
9
9
  let(:presenter) { described_class.new(document, request_context, config) }
10
10
  let(:parameter_class) { ActionController::Parameters }
11
11
  let(:params) { parameter_class.new }
12
- let(:search_state) { Blacklight::SearchState.new(params, config) }
12
+ let(:controller) { double }
13
+ let(:search_state) { Blacklight::SearchState.new(params, config, controller) }
13
14
 
14
15
  let(:document) do
15
16
  SolrDocument.new(id: 1,
@@ -9,7 +9,8 @@ describe Blacklight::ShowPresenter do
9
9
  let(:presenter) { described_class.new(document, request_context, config) }
10
10
  let(:parameter_class) { ActionController::Parameters }
11
11
  let(:params) { parameter_class.new }
12
- let(:search_state) { Blacklight::SearchState.new(params, config) }
12
+ let(:controller) { double }
13
+ let(:search_state) { Blacklight::SearchState.new(params, config, controller) }
13
14
 
14
15
  let(:document) do
15
16
  SolrDocument.new(id: 1,
@@ -4,7 +4,7 @@ module ControllerLevelHelpers
4
4
  include Blacklight::Facet
5
5
 
6
6
  def search_state
7
- @search_state ||= Blacklight::SearchState.new(params, blacklight_config)
7
+ @search_state ||= Blacklight::SearchState.new(params, blacklight_config, controller)
8
8
  end
9
9
 
10
10
  def blacklight_configuration_context
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.8.0
4
+ version: 6.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Rochkind
@@ -17,7 +17,7 @@ authors:
17
17
  autorequire:
18
18
  bindir: exe
19
19
  cert_chain: []
20
- date: 2017-03-03 00:00:00.000000000 Z
20
+ date: 2017-05-02 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rails
@@ -205,14 +205,14 @@ dependencies:
205
205
  requirements:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
- version: 2.6.0
208
+ version: '2.6'
209
209
  type: :development
210
210
  prerelease: false
211
211
  version_requirements: !ruby/object:Gem::Requirement
212
212
  requirements:
213
213
  - - "~>"
214
214
  - !ruby/object:Gem::Version
215
- version: 2.6.0
215
+ version: '2.6'
216
216
  - !ruby/object:Gem::Dependency
217
217
  name: poltergeist
218
218
  requirement: !ruby/object:Gem::Requirement
@@ -287,16 +287,16 @@ dependencies:
287
287
  name: rubocop
288
288
  requirement: !ruby/object:Gem::Requirement
289
289
  requirements:
290
- - - ">="
290
+ - - "~>"
291
291
  - !ruby/object:Gem::Version
292
- version: '0'
292
+ version: 0.47.0
293
293
  type: :development
294
294
  prerelease: false
295
295
  version_requirements: !ruby/object:Gem::Requirement
296
296
  requirements:
297
- - - ">="
297
+ - - "~>"
298
298
  - !ruby/object:Gem::Version
299
- version: '0'
299
+ version: 0.47.0
300
300
  - !ruby/object:Gem::Dependency
301
301
  name: rubocop-rspec
302
302
  requirement: !ruby/object:Gem::Requirement
@@ -505,7 +505,6 @@ files:
505
505
  - app/views/catalog/index.html.erb
506
506
  - app/views/catalog/index.json.jbuilder
507
507
  - app/views/catalog/index.rss.builder
508
- - app/views/catalog/opensearch.json.erb
509
508
  - app/views/catalog/opensearch.xml.builder
510
509
  - app/views/catalog/send_email_record.erb
511
510
  - app/views/catalog/show.html.erb
@@ -538,6 +537,7 @@ files:
538
537
  - config/locales/blacklight.fr.yml
539
538
  - config/locales/blacklight.it.yml
540
539
  - config/locales/blacklight.pt-BR.yml
540
+ - config/locales/blacklight.sq.yml
541
541
  - config/routes.rb
542
542
  - db/migrate/20140202020201_create_searches.rb
543
543
  - db/migrate/20140202020202_create_bookmarks.rb
@@ -748,7 +748,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
748
748
  version: '0'
749
749
  requirements: []
750
750
  rubyforge_project:
751
- rubygems_version: 2.6.8
751
+ rubygems_version: 2.6.11
752
752
  signing_key:
753
753
  specification_version: 4
754
754
  summary: Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr)
File without changes