blacklight_cql 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/app/controllers/blacklight_cql/explain_controller.rb +1 -1
- data/app/helpers/blacklight_cql/explain_helper.rb +4 -5
- data/lib/blacklight_cql/blacklight_to_solr.rb +2 -2
- data/lib/blacklight_cql/engine.rb +5 -2
- data/lib/blacklight_cql/solr_helper_extension.rb +13 -7
- data/lib/blacklight_cql/template_helper_extension.rb +1 -1
- data/spec/app_root/Rakefile +7 -0
- data/spec/app_root/app/assets/javascripts/application.js +9 -0
- data/spec/app_root/app/assets/stylesheets/application.css +7 -0
- data/spec/app_root/app/controllers/application_controller.rb +1 -0
- data/spec/app_root/app/helpers/application_helper.rb +2 -0
- data/spec/app_root/app/views/layouts/application.html.erb +14 -0
- data/spec/app_root/config/application.rb +45 -0
- data/spec/app_root/config/boot.rb +7 -112
- data/spec/app_root/config/database.yml +17 -23
- data/spec/app_root/config/environment.rb +4 -29
- data/spec/app_root/config/environments/development.rb +30 -0
- data/spec/app_root/config/environments/production.rb +60 -0
- data/spec/app_root/config/environments/test.rb +39 -0
- data/spec/app_root/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/app_root/config/initializers/inflections.rb +10 -0
- data/spec/app_root/config/initializers/mime_types.rb +5 -0
- data/spec/app_root/config/initializers/secret_token.rb +7 -0
- data/spec/app_root/config/initializers/session_store.rb +8 -0
- data/spec/app_root/config/initializers/wrap_parameters.rb +14 -0
- data/spec/app_root/config/locales/en.yml +5 -0
- data/spec/app_root/config/routes.rb +57 -3
- data/spec/app_root/config.ru +4 -0
- data/spec/app_root/db/test.sqlite3 +0 -0
- data/spec/app_root/{config/environments/in_memory.rb → log/development.log} +0 -0
- data/spec/app_root/{config/environments/mysql.rb → log/in_memory.log} +0 -0
- data/spec/app_root/log/test.log +42 -0
- data/spec/app_root/public/404.html +26 -0
- data/spec/app_root/public/422.html +26 -0
- data/spec/app_root/public/500.html +26 -0
- data/spec/app_root/{config/environments/postgresql.rb → public/favicon.ico} +0 -0
- data/spec/app_root/script/rails +6 -0
- data/spec/app_root/spec/spec_helper.rb +33 -0
- data/spec/lib/blacklight_to_solr_spec.rb +8 -27
- data/spec/spec_helper.rb +26 -42
- data/spec/views/explain.xml.builder_spec.rb +67 -42
- metadata +115 -34
- data/spec/app_root/config/environments/sqlite.rb +0 -0
- data/spec/app_root/config/environments/sqlite3.rb +0 -0
- data/spec/app_root/lib/blacklight/search_fields.rb +0 -97
- data/spec/app_root/lib/console_with_fixtures.rb +0 -4
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight_cql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
- 0
|
9
8
|
- 1
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 1.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jonathan Rochkind
|
@@ -15,12 +15,9 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
19
|
-
default_executable:
|
18
|
+
date: 2011-12-14 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
|
-
name: rails
|
23
|
-
prerelease: false
|
24
21
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
22
|
none: false
|
26
23
|
requirements:
|
@@ -31,24 +28,24 @@ dependencies:
|
|
31
28
|
- 3
|
32
29
|
- 0
|
33
30
|
version: "3.0"
|
34
|
-
type: :runtime
|
35
31
|
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: blacklight
|
38
32
|
prerelease: false
|
33
|
+
name: rails
|
34
|
+
type: :runtime
|
35
|
+
- !ruby/object:Gem::Dependency
|
39
36
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
37
|
none: false
|
41
38
|
requirements:
|
42
39
|
- - ">="
|
43
40
|
- !ruby/object:Gem::Version
|
44
|
-
hash:
|
41
|
+
hash: 1923832045
|
45
42
|
segments:
|
46
43
|
- 3
|
47
|
-
-
|
44
|
+
- 2
|
48
45
|
- 0
|
49
46
|
- pre
|
50
|
-
-
|
51
|
-
version: 3.
|
47
|
+
- 2
|
48
|
+
version: 3.2.0pre2
|
52
49
|
- - <
|
53
50
|
- !ruby/object:Gem::Version
|
54
51
|
hash: 63
|
@@ -57,11 +54,11 @@ dependencies:
|
|
57
54
|
- 0
|
58
55
|
- 0
|
59
56
|
version: 4.0.0
|
60
|
-
type: :runtime
|
61
57
|
version_requirements: *id002
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: cql-ruby
|
64
58
|
prerelease: false
|
59
|
+
name: blacklight
|
60
|
+
type: :runtime
|
61
|
+
- !ruby/object:Gem::Dependency
|
65
62
|
requirement: &id003 !ruby/object:Gem::Requirement
|
66
63
|
none: false
|
67
64
|
requirements:
|
@@ -73,8 +70,53 @@ dependencies:
|
|
73
70
|
- 8
|
74
71
|
- 1
|
75
72
|
version: 0.8.1
|
76
|
-
type: :runtime
|
77
73
|
version_requirements: *id003
|
74
|
+
prerelease: false
|
75
|
+
name: cql-ruby
|
76
|
+
type: :runtime
|
77
|
+
- !ruby/object:Gem::Dependency
|
78
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
hash: 3
|
84
|
+
segments:
|
85
|
+
- 0
|
86
|
+
version: "0"
|
87
|
+
version_requirements: *id004
|
88
|
+
prerelease: false
|
89
|
+
name: sqlite3
|
90
|
+
type: :development
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
93
|
+
none: false
|
94
|
+
requirements:
|
95
|
+
- - ~>
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
hash: 15
|
98
|
+
segments:
|
99
|
+
- 2
|
100
|
+
- 6
|
101
|
+
version: "2.6"
|
102
|
+
version_requirements: *id005
|
103
|
+
prerelease: false
|
104
|
+
name: rspec-rails
|
105
|
+
type: :development
|
106
|
+
- !ruby/object:Gem::Dependency
|
107
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
hash: 3
|
113
|
+
segments:
|
114
|
+
- 0
|
115
|
+
version: "0"
|
116
|
+
version_requirements: *id006
|
117
|
+
prerelease: false
|
118
|
+
name: nokogiri
|
119
|
+
type: :development
|
78
120
|
description:
|
79
121
|
email:
|
80
122
|
- blacklight-development@googlegroups.com
|
@@ -105,19 +147,38 @@ files:
|
|
105
147
|
- spec/marc_data/social_journal.mrc
|
106
148
|
- spec/spec.opts
|
107
149
|
- spec/app_root/app/controllers/application_controller.rb
|
108
|
-
- spec/app_root/
|
109
|
-
- spec/app_root/
|
110
|
-
- spec/app_root/
|
111
|
-
- spec/app_root/
|
112
|
-
- spec/app_root/
|
113
|
-
- spec/app_root/
|
114
|
-
- spec/app_root/
|
150
|
+
- spec/app_root/app/assets/javascripts/application.js
|
151
|
+
- spec/app_root/app/assets/stylesheets/application.css
|
152
|
+
- spec/app_root/app/views/layouts/application.html.erb
|
153
|
+
- spec/app_root/app/helpers/application_helper.rb
|
154
|
+
- spec/app_root/spec/spec_helper.rb
|
155
|
+
- spec/app_root/public/404.html
|
156
|
+
- spec/app_root/public/422.html
|
157
|
+
- spec/app_root/public/favicon.ico
|
158
|
+
- spec/app_root/public/500.html
|
159
|
+
- spec/app_root/config/environments/development.rb
|
160
|
+
- spec/app_root/config/environments/production.rb
|
161
|
+
- spec/app_root/config/environments/test.rb
|
162
|
+
- spec/app_root/config/application.rb
|
115
163
|
- spec/app_root/config/environment.rb
|
116
164
|
- spec/app_root/config/database.yml
|
117
165
|
- spec/app_root/config/routes.rb
|
166
|
+
- spec/app_root/config/locales/en.yml
|
118
167
|
- spec/app_root/config/boot.rb
|
168
|
+
- spec/app_root/config/initializers/inflections.rb
|
169
|
+
- spec/app_root/config/initializers/backtrace_silencers.rb
|
170
|
+
- spec/app_root/config/initializers/wrap_parameters.rb
|
171
|
+
- spec/app_root/config/initializers/mime_types.rb
|
172
|
+
- spec/app_root/config/initializers/session_store.rb
|
173
|
+
- spec/app_root/config/initializers/secret_token.rb
|
174
|
+
- spec/app_root/Rakefile
|
175
|
+
- spec/app_root/script/rails
|
176
|
+
- spec/app_root/config.ru
|
177
|
+
- spec/app_root/db/test.sqlite3
|
178
|
+
- spec/app_root/log/test.log
|
179
|
+
- spec/app_root/log/development.log
|
180
|
+
- spec/app_root/log/in_memory.log
|
119
181
|
- spec/views/explain.xml.builder_spec.rb
|
120
|
-
has_rdoc: true
|
121
182
|
homepage: http://projectblacklight.org/
|
122
183
|
licenses: []
|
123
184
|
|
@@ -147,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
208
|
requirements: []
|
148
209
|
|
149
210
|
rubyforge_project: blacklight
|
150
|
-
rubygems_version: 1.
|
211
|
+
rubygems_version: 1.8.12
|
151
212
|
signing_key:
|
152
213
|
specification_version: 3
|
153
214
|
summary: Blacklight CQL plugin
|
@@ -161,15 +222,35 @@ test_files:
|
|
161
222
|
- spec/marc_data/social_journal.mrc
|
162
223
|
- spec/spec.opts
|
163
224
|
- spec/app_root/app/controllers/application_controller.rb
|
164
|
-
- spec/app_root/
|
165
|
-
- spec/app_root/
|
166
|
-
- spec/app_root/
|
167
|
-
- spec/app_root/
|
168
|
-
- spec/app_root/
|
169
|
-
- spec/app_root/
|
170
|
-
- spec/app_root/
|
225
|
+
- spec/app_root/app/assets/javascripts/application.js
|
226
|
+
- spec/app_root/app/assets/stylesheets/application.css
|
227
|
+
- spec/app_root/app/views/layouts/application.html.erb
|
228
|
+
- spec/app_root/app/helpers/application_helper.rb
|
229
|
+
- spec/app_root/spec/spec_helper.rb
|
230
|
+
- spec/app_root/public/404.html
|
231
|
+
- spec/app_root/public/422.html
|
232
|
+
- spec/app_root/public/favicon.ico
|
233
|
+
- spec/app_root/public/500.html
|
234
|
+
- spec/app_root/config/environments/development.rb
|
235
|
+
- spec/app_root/config/environments/production.rb
|
236
|
+
- spec/app_root/config/environments/test.rb
|
237
|
+
- spec/app_root/config/application.rb
|
171
238
|
- spec/app_root/config/environment.rb
|
172
239
|
- spec/app_root/config/database.yml
|
173
240
|
- spec/app_root/config/routes.rb
|
241
|
+
- spec/app_root/config/locales/en.yml
|
174
242
|
- spec/app_root/config/boot.rb
|
243
|
+
- spec/app_root/config/initializers/inflections.rb
|
244
|
+
- spec/app_root/config/initializers/backtrace_silencers.rb
|
245
|
+
- spec/app_root/config/initializers/wrap_parameters.rb
|
246
|
+
- spec/app_root/config/initializers/mime_types.rb
|
247
|
+
- spec/app_root/config/initializers/session_store.rb
|
248
|
+
- spec/app_root/config/initializers/secret_token.rb
|
249
|
+
- spec/app_root/Rakefile
|
250
|
+
- spec/app_root/script/rails
|
251
|
+
- spec/app_root/config.ru
|
252
|
+
- spec/app_root/db/test.sqlite3
|
253
|
+
- spec/app_root/log/test.log
|
254
|
+
- spec/app_root/log/development.log
|
255
|
+
- spec/app_root/log/in_memory.log
|
175
256
|
- spec/views/explain.xml.builder_spec.rb
|
File without changes
|
File without changes
|
@@ -1,97 +0,0 @@
|
|
1
|
-
##
|
2
|
-
# Module to deal with accessing (and setting some defaults) in an array of
|
3
|
-
# hashes that describe Blacklight search fields. Requires the base class this
|
4
|
-
# module is added to implements a #config method that returns a hash, where
|
5
|
-
# config[:search_fields] will be an array of hashes describing search fields.
|
6
|
-
#
|
7
|
-
# = Search Field Configuration Hash =
|
8
|
-
# [:display_label]
|
9
|
-
# "Title", # user-displayable label
|
10
|
-
# [:qt]
|
11
|
-
# "search", # Solr qt param, request handler, defaults to Blacklight.config[:default_qt] if left blank.
|
12
|
-
# [:solr_parameters]
|
13
|
-
# {:qf => "something"} # optional hash of additional parameters to pass to solr for searches on this field.
|
14
|
-
# [:solr_local_parameters]
|
15
|
-
# {:qf => "$something"} # optional hash of additional parameters that will be passed using Solr LocalParams syntax, that can use dollar sign to reference other solr variables.
|
16
|
-
# [:include_in_simple_select]
|
17
|
-
# false. Defaults to true, but you can set to false to have a search field defined for deep-links or BL extensions, but not actually included in the HTML select for simple search choice.
|
18
|
-
#
|
19
|
-
# Optionally you can supply a :key, which is what Blacklight will use
|
20
|
-
# to identify this search field in HTTP query params. If no :key is
|
21
|
-
# supplied, one will be computed from the :display_label. If that will
|
22
|
-
# result in a collision of keys, you should supply one explicitly.
|
23
|
-
#
|
24
|
-
##
|
25
|
-
module Blacklight::SearchFields
|
26
|
-
extend ActiveSupport::Memoizable
|
27
|
-
|
28
|
-
# Looks up search field config list from config[:search_fields], and
|
29
|
-
# 'normalizes' all field config hashes using normalize_config method.
|
30
|
-
# Memoized for efficiency of normalization.
|
31
|
-
def search_field_list
|
32
|
-
config[:search_fields].collect {|obj| normalize_config(obj)}
|
33
|
-
end
|
34
|
-
memoize :search_field_list
|
35
|
-
|
36
|
-
# Returns suitable argument to options_for_select method, to create
|
37
|
-
# an html select based on #search_field_list. Skips search_fields
|
38
|
-
# marked :include_in_simple_select => false
|
39
|
-
def search_field_options_for_select
|
40
|
-
search_field_list.collect do |field_def|
|
41
|
-
[field_def[:display_label], field_def[:key]] unless field_def[:include_in_simple_select] == false
|
42
|
-
end.compact
|
43
|
-
end
|
44
|
-
|
45
|
-
# Looks up a search field config hash from search_field_list having
|
46
|
-
# a certain supplied :key.
|
47
|
-
def search_field_def_for_key(key)
|
48
|
-
return nil if key.blank?
|
49
|
-
search_field_list.find {|c| c[:key] == key}
|
50
|
-
end
|
51
|
-
|
52
|
-
# Returns default search field, used for simpler display in history, etc.
|
53
|
-
# if not set in config, defaults to first field listed in #search_field_list
|
54
|
-
def default_search_field
|
55
|
-
config[:default_search_field] || search_field_list[0]
|
56
|
-
end
|
57
|
-
memoize :default_search_field
|
58
|
-
|
59
|
-
# Shortcut for commonly needed operation, look up display
|
60
|
-
# label for the key specified. Returns "Keyword" if a label
|
61
|
-
# can't be found.
|
62
|
-
def label_for_search_field(key)
|
63
|
-
field_def = search_field_def_for_key(key)
|
64
|
-
if field_def && field_def[:display_label]
|
65
|
-
field_def[:display_label]
|
66
|
-
else
|
67
|
-
"Keyword"
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
protected
|
72
|
-
# Fill in missing default values in a search_field config hash.
|
73
|
-
def normalize_config(field_hash)
|
74
|
-
|
75
|
-
|
76
|
-
# Accept legacy two-element array, if it's not a Hash, assume it's legacy.
|
77
|
-
# No great way to 'duck type' here.
|
78
|
-
unless ( field_hash.kind_of?(Hash))
|
79
|
-
# Consistent with legacy behavior where two fields can have the same label,
|
80
|
-
# as long as they have different qt's, we base the unique :key on :qt.
|
81
|
-
field_hash = {:display_label => field_hash[0], :key => field_hash[1], :qt => field_hash[1]}
|
82
|
-
else
|
83
|
-
# Make a copy of passed in Hash so we don't alter original.
|
84
|
-
field_hash = field_hash.clone
|
85
|
-
end
|
86
|
-
|
87
|
-
# If no key was provided, turn the display label into one.
|
88
|
-
field_hash[:key] ||= field_hash[:display_label].downcase.gsub(/[^a-z0-9]+/,'_')
|
89
|
-
|
90
|
-
# If no :qt was provided, take from config default
|
91
|
-
field_hash[:qt] ||= config[:default_qt]
|
92
|
-
|
93
|
-
field_hash
|
94
|
-
end
|
95
|
-
|
96
|
-
|
97
|
-
end
|
@@ -1,4 +0,0 @@
|
|
1
|
-
# Loads fixtures into the database when running the test app via the console
|
2
|
-
(ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(Rails.root, '../fixtures/*.{yml,csv}'))).each do |fixture_file|
|
3
|
-
Fixtures.create_fixtures(File.join(Rails.root, '../fixtures'), File.basename(fixture_file, '.*'))
|
4
|
-
end
|