blacklight_cql 0.9.1 → 1.0.0pre1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/blacklight_cql/engine.rb +40 -0
- data/lib/blacklight_cql/solr_helper_extension.rb +1 -3
- data/lib/blacklight_cql/version.rb +9 -0
- data/lib/blacklight_cql.rb +3 -0
- data/spec/{blacklight_to_solr_spec.rb → lib/blacklight_to_solr_spec.rb} +1 -1
- metadata +97 -62
- data/MIT-LICENSE +0 -20
- data/README.rdoc +0 -142
- data/Rakefile +0 -43
- data/VERSION +0 -1
- data/init.rb +0 -1
- data/install.rb +0 -1
- data/rails/init.rb +0 -32
- data/tasks/blacklight_cql_tasks.rake +0 -4
- data/uninstall.rb +0 -1
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'cql_ruby'
|
2
|
+
|
3
|
+
require 'rails'
|
4
|
+
require 'blacklight'
|
5
|
+
require 'blacklight_cql'
|
6
|
+
|
7
|
+
require 'blacklight_cql/solr_helper_extension'
|
8
|
+
require 'blacklight_cql/template_helper_extension'
|
9
|
+
|
10
|
+
|
11
|
+
module BlacklightCql
|
12
|
+
class Engine < Rails::Engine
|
13
|
+
|
14
|
+
|
15
|
+
# Call in after_initialze to make sure the default search_fields are
|
16
|
+
# already created, AND the local app has had the opportunity to customize
|
17
|
+
# our placeholder search_field.
|
18
|
+
config.after_initialize do
|
19
|
+
Blacklight.config[:search_fields] << BlacklightCql::SolrHelperExtension.pseudo_search_field
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
# Wrapping in Dispatcher.to_prepare will, theoretically, take care of things
|
24
|
+
# working properly even in development mode with cache_classes=false (per-request
|
25
|
+
# class reloading).
|
26
|
+
config.to_prepare do
|
27
|
+
#Check in case CatalogController _hasn't_ really been re-loaded
|
28
|
+
unless (CatalogController.kind_of?( BlacklightCql::SolrHelperExtension ))
|
29
|
+
# Will over-ride #solr_params to deal with CQL
|
30
|
+
CatalogController.send(:include, BlacklightCql::SolrHelperExtension)
|
31
|
+
|
32
|
+
# Will over-ride helper methods for search form select, to ensure
|
33
|
+
# query is echo'd properly.
|
34
|
+
CatalogController.send(:helper, BlacklightCql::TemplateHelperExtension)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
@@ -7,9 +7,7 @@
|
|
7
7
|
# alias_method_chain instead, thankfully we do not.
|
8
8
|
module BlacklightCql::SolrHelperExtension
|
9
9
|
mattr_accessor :pseudo_search_field
|
10
|
-
|
11
|
-
# to parse this for parens and booleans, we're taking care of it!
|
12
|
-
self.pseudo_search_field = {:key => "cql", :display_label => "External Search (CQL)", :include_in_simple_select => false, :advanced_parse_q => false}
|
10
|
+
self.pseudo_search_field = {:key => "cql", :display_label => "External Search (CQL)", :include_in_simple_select => false}
|
13
11
|
|
14
12
|
# Over-ride solr_search_params to do special CQL-to-complex-solr-query
|
15
13
|
# processing iff the "search_field" is our pseudo-search-field indicating
|
data/lib/blacklight_cql.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight_cql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 1923831947
|
5
|
+
prerelease: 5
|
6
6
|
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
7
9
|
- 0
|
8
|
-
-
|
10
|
+
- pre
|
9
11
|
- 1
|
10
|
-
version: 0.
|
12
|
+
version: 1.0.0pre1
|
11
13
|
platform: ruby
|
12
14
|
authors:
|
13
15
|
- Jonathan Rochkind
|
@@ -15,88 +17,99 @@ autorequire:
|
|
15
17
|
bindir: bin
|
16
18
|
cert_chain: []
|
17
19
|
|
18
|
-
date: 2011-
|
19
|
-
default_executable:
|
20
|
+
date: 2011-06-09 00:00:00 Z
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
22
|
-
name:
|
23
|
+
name: rails
|
23
24
|
prerelease: false
|
24
25
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
26
|
none: false
|
26
27
|
requirements:
|
27
|
-
- -
|
28
|
+
- - ~>
|
28
29
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
30
|
+
hash: 7
|
30
31
|
segments:
|
32
|
+
- 3
|
31
33
|
- 0
|
32
|
-
|
33
|
-
- 1
|
34
|
-
version: 0.8.1
|
34
|
+
version: "3.0"
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id001
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
|
-
name:
|
38
|
+
name: blacklight
|
39
39
|
prerelease: false
|
40
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
|
-
- -
|
43
|
+
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
hash:
|
45
|
+
hash: 1923832001
|
46
46
|
segments:
|
47
|
+
- 3
|
47
48
|
- 0
|
48
|
-
|
49
|
-
|
49
|
+
- 0
|
50
|
+
- pre
|
51
|
+
- 4
|
52
|
+
version: 3.0.0pre4
|
53
|
+
type: :runtime
|
50
54
|
version_requirements: *id002
|
51
|
-
|
52
|
-
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: cql-ruby
|
57
|
+
prerelease: false
|
58
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
hash: 61
|
64
|
+
segments:
|
65
|
+
- 0
|
66
|
+
- 8
|
67
|
+
- 1
|
68
|
+
version: 0.8.1
|
69
|
+
type: :runtime
|
70
|
+
version_requirements: *id003
|
71
|
+
description:
|
72
|
+
email:
|
73
|
+
- blacklight-development@googlegroups.com
|
53
74
|
executables: []
|
54
75
|
|
55
76
|
extensions: []
|
56
77
|
|
57
|
-
extra_rdoc_files:
|
58
|
-
|
78
|
+
extra_rdoc_files: []
|
79
|
+
|
59
80
|
files:
|
60
|
-
-
|
61
|
-
-
|
62
|
-
-
|
63
|
-
-
|
81
|
+
- lib/blacklight_cql/blacklight_to_solr.rb
|
82
|
+
- lib/blacklight_cql/template_helper_extension.rb
|
83
|
+
- lib/blacklight_cql/version.rb
|
84
|
+
- lib/blacklight_cql/solr_helper_extension.rb
|
85
|
+
- lib/blacklight_cql/engine.rb
|
86
|
+
- lib/blacklight_cql.rb
|
64
87
|
- app/controllers/blacklight_cql/explain_controller.rb
|
65
|
-
- app/helpers/blacklight_cql/explain_helper.rb
|
66
88
|
- app/views/blacklight_cql/explain/explain.xml.builder
|
89
|
+
- app/helpers/blacklight_cql/explain_helper.rb
|
67
90
|
- config/routes.rb
|
68
|
-
-
|
69
|
-
-
|
70
|
-
- lib/blacklight_cql.rb
|
71
|
-
- lib/blacklight_cql/blacklight_to_solr.rb
|
72
|
-
- lib/blacklight_cql/solr_helper_extension.rb
|
73
|
-
- lib/blacklight_cql/template_helper_extension.rb
|
74
|
-
- rails/init.rb
|
75
|
-
- spec/app_root/app/controllers/application_controller.rb
|
76
|
-
- spec/app_root/config/boot.rb
|
77
|
-
- spec/app_root/config/database.yml
|
78
|
-
- spec/app_root/config/environment.rb
|
79
|
-
- spec/app_root/config/environments/in_memory.rb
|
80
|
-
- spec/app_root/config/environments/mysql.rb
|
81
|
-
- spec/app_root/config/environments/postgresql.rb
|
82
|
-
- spec/app_root/config/environments/sqlite.rb
|
83
|
-
- spec/app_root/config/environments/sqlite3.rb
|
84
|
-
- spec/app_root/config/routes.rb
|
85
|
-
- spec/app_root/lib/blacklight/search_fields.rb
|
86
|
-
- spec/app_root/lib/console_with_fixtures.rb
|
87
|
-
- spec/blacklight_to_solr_spec.rb
|
88
|
-
- spec/data/luke.yaml
|
91
|
+
- spec/lib/blacklight_to_solr_spec.rb
|
92
|
+
- spec/rcov.opts
|
89
93
|
- spec/data/zeerex-2.0.xsd
|
94
|
+
- spec/data/luke.yaml
|
95
|
+
- spec/spec_helper.rb
|
90
96
|
- spec/marc_data/chomsky.mrc
|
91
97
|
- spec/marc_data/social_journal.mrc
|
92
|
-
- spec/rcov.opts
|
93
98
|
- spec/spec.opts
|
94
|
-
- spec/
|
99
|
+
- spec/app_root/app/controllers/application_controller.rb
|
100
|
+
- spec/app_root/lib/console_with_fixtures.rb
|
101
|
+
- spec/app_root/lib/blacklight/search_fields.rb
|
102
|
+
- spec/app_root/config/environments/postgresql.rb
|
103
|
+
- spec/app_root/config/environments/sqlite3.rb
|
104
|
+
- spec/app_root/config/environments/sqlite.rb
|
105
|
+
- spec/app_root/config/environments/in_memory.rb
|
106
|
+
- spec/app_root/config/environments/mysql.rb
|
107
|
+
- spec/app_root/config/environment.rb
|
108
|
+
- spec/app_root/config/database.yml
|
109
|
+
- spec/app_root/config/routes.rb
|
110
|
+
- spec/app_root/config/boot.rb
|
95
111
|
- spec/views/explain.xml.builder_spec.rb
|
96
|
-
|
97
|
-
- uninstall.rb
|
98
|
-
has_rdoc: true
|
99
|
-
homepage: http://github.com/projectblacklight/blacklight_cql
|
112
|
+
homepage: http://projectblacklight.org/
|
100
113
|
licenses: []
|
101
114
|
|
102
115
|
post_install_message:
|
@@ -116,18 +129,40 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
116
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
130
|
none: false
|
118
131
|
requirements:
|
119
|
-
- - "
|
132
|
+
- - ">"
|
120
133
|
- !ruby/object:Gem::Version
|
121
|
-
hash:
|
134
|
+
hash: 25
|
122
135
|
segments:
|
123
|
-
-
|
124
|
-
|
136
|
+
- 1
|
137
|
+
- 3
|
138
|
+
- 1
|
139
|
+
version: 1.3.1
|
125
140
|
requirements: []
|
126
141
|
|
127
|
-
rubyforge_project:
|
128
|
-
rubygems_version: 1.
|
142
|
+
rubyforge_project: blacklight
|
143
|
+
rubygems_version: 1.7.2
|
129
144
|
signing_key:
|
130
145
|
specification_version: 3
|
131
|
-
summary:
|
132
|
-
test_files:
|
133
|
-
|
146
|
+
summary: Blacklight CQL plugin
|
147
|
+
test_files:
|
148
|
+
- spec/lib/blacklight_to_solr_spec.rb
|
149
|
+
- spec/rcov.opts
|
150
|
+
- spec/data/zeerex-2.0.xsd
|
151
|
+
- spec/data/luke.yaml
|
152
|
+
- spec/spec_helper.rb
|
153
|
+
- spec/marc_data/chomsky.mrc
|
154
|
+
- spec/marc_data/social_journal.mrc
|
155
|
+
- spec/spec.opts
|
156
|
+
- spec/app_root/app/controllers/application_controller.rb
|
157
|
+
- spec/app_root/lib/console_with_fixtures.rb
|
158
|
+
- spec/app_root/lib/blacklight/search_fields.rb
|
159
|
+
- spec/app_root/config/environments/postgresql.rb
|
160
|
+
- spec/app_root/config/environments/sqlite3.rb
|
161
|
+
- spec/app_root/config/environments/sqlite.rb
|
162
|
+
- spec/app_root/config/environments/in_memory.rb
|
163
|
+
- spec/app_root/config/environments/mysql.rb
|
164
|
+
- spec/app_root/config/environment.rb
|
165
|
+
- spec/app_root/config/database.yml
|
166
|
+
- spec/app_root/config/routes.rb
|
167
|
+
- spec/app_root/config/boot.rb
|
168
|
+
- spec/views/explain.xml.builder_spec.rb
|
data/MIT-LICENSE
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2010 [name of plugin creator]
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
DELETED
@@ -1,142 +0,0 @@
|
|
1
|
-
= Blacklight-cql
|
2
|
-
|
3
|
-
An extension for the Blacklight solr search front-end.
|
4
|
-
|
5
|
-
http://projectblacklight.org
|
6
|
-
|
7
|
-
http://github.com/projectblacklight/blacklight
|
8
|
-
|
9
|
-
Provides for CQL search queries that map to Solr and Blacklight fields.
|
10
|
-
|
11
|
-
|
12
|
-
= Installation
|
13
|
-
|
14
|
-
Add to your local app's environment.rb:
|
15
|
-
config.gem "blacklight_cql"
|
16
|
-
|
17
|
-
Run "rake gems:install". That's it, you now have CQL support in your Blacklight.
|
18
|
-
|
19
|
-
See below for optional configuration to change default behavior.
|
20
|
-
|
21
|
-
= Use
|
22
|
-
|
23
|
-
http://your.blacklight.com/catalog?search_field=cql&q=[uri-encoded cql query]
|
24
|
-
|
25
|
-
Or for an atom response for instance,
|
26
|
-
|
27
|
-
http://your.blacklight.com/catalog.atom?search_field=cql&q=[uri-encoded cql query]
|
28
|
-
|
29
|
-
See http://www.loc.gov/standards/sru/specs/cql.html for more info on CQL syntax and semantics.
|
30
|
-
|
31
|
-
Any search_field you have configured in Blacklight.config[:search_fields] (probably in your config/blacklight_config.rb) is available as a CQL index. These search fields are only available with the custom "solr.dismax" CQL relation, taking a CQL expression as a value.
|
32
|
-
|
33
|
-
some_field solr.dismax "term +required -negate \"a phrase\" "
|
34
|
-
|
35
|
-
For dismax fields, the "=" server-choice relation means the same thing:
|
36
|
-
|
37
|
-
some_field = "term +required -negate \"a phrase\" "
|
38
|
-
|
39
|
-
Any Solr indexed field is also available as a CQL index. A much greater range of CQL relations are supported when you specify a Solr indexed field directly.
|
40
|
-
|
41
|
-
solr_field cql.adj "some phrase" AND solr_year within "1990 2000"
|
42
|
-
|
43
|
-
Solr indexed field CQL support is provided by the cql_ruby gem, for details on relations supported see: http://cql-ruby.rubyforge.org/svn/trunk/lib/cql_ruby/cql_to_solr.rb
|
44
|
-
|
45
|
-
If there is a direct solr indexed field with the same name as a Blacklight-configured dismax field, the BL field will take precedence. You can use explicit CQL "context set" prefixes to disambiguate.
|
46
|
-
|
47
|
-
[lsolr.field]
|
48
|
-
"lsolr" prefix means a direct solr indexed field
|
49
|
-
[local.some_field]
|
50
|
-
"local" prefix means a dismax field configured in Blacklight.config[:search_fields]
|
51
|
-
|
52
|
-
These prefixes can be changed, see configuration below.
|
53
|
-
|
54
|
-
Raw solr fields and Blacklight config'ed fields CAN be mixed together in a single CQL query.
|
55
|
-
|
56
|
-
(lsolr.title_t any "one two three" AND lsolr.author_t all "smith john") OR local.title = "my dismax title query"
|
57
|
-
|
58
|
-
CQL *does* need to be URL escaped in a URL, of course:
|
59
|
-
|
60
|
-
http://some.blacklight.com/catalog.atom?search_field=cql&q=%28lsolr.title_t+any+%22one+two+three%22+AND+lsolr.author_t+all+%22smith+john%22%29+OR+local.title+%3D+%22my+dismax+title+query%22
|
61
|
-
|
62
|
-
For "solr.dismax" or "=" relations, the the cql.serverChoice index maps to your default blacklight-configed field and solr.dismax relation. Otherwise, it maps to a direct solr field query with "adj", and the solr indexed field generally ends up being "text", although this depends on your configuration.
|
63
|
-
|
64
|
-
= SRU/ZeeRex Explain
|
65
|
-
|
66
|
-
This plugin does *not* provide a full SRU server. However, a ZeeRex/SRU explain document is provided by the plugin to advertise, in machine-readable format, what CQL indexes (ie, search fields) are provided by the server, and what relations are supported on each search field.
|
67
|
-
|
68
|
-
The explain document can be found at /catalog/explain on your server. (This URL end-point is not presently configurable).
|
69
|
-
|
70
|
-
For solr fields themselves, the plugin finds them via a Solr luke request, looking for any field that is Indexed in solr, and advertising it. (If you have configured lucene indexes directly not through solr, they will likely be erroneously included in the explain as well).
|
71
|
-
|
72
|
-
For Blacklight fields, Blacklight.config[:search_fields] is used to discover fields to put in the Explain.
|
73
|
-
|
74
|
-
Note that at present only the custom solr.dismax relation is supported on Blacklight fields. Most of the standard CQL relations are supported on raw solr fields.
|
75
|
-
|
76
|
-
|
77
|
-
= Configuration
|
78
|
-
|
79
|
-
== URL cql key, and cql label
|
80
|
-
|
81
|
-
A psuedo-blacklight-search-field is added by the Cql plugin to indicate a CQL search in the URL and BL processing. You can change the definition of this psuedo-field however you want to change the URL search_field key, the label for a CQL search echoed back to the user in HTML, or even to add some additional Solr parameters for the top-level Solr query for CQL searches. The value is a hash with the same semantics as other Blacklight.config[:search_fields] elements.
|
82
|
-
|
83
|
-
In an initializer:
|
84
|
-
BlacklightCql::SolrHelperExtension.psuedo_search_field = {
|
85
|
-
:key => "super_search",
|
86
|
-
:display_label => "The Super Search",
|
87
|
-
:solr_parameters => { "mm" => "100%" }
|
88
|
-
}
|
89
|
-
|
90
|
-
== Dismax search field configuration
|
91
|
-
|
92
|
-
All fields configured in Blacklight.config[:search_fields] are available as CQL indexes. If you'd like to make more dismax-configured search fields available in CQL but not the standard HTML search select menu, simply add them with :show_in_simple_select = false, eg:
|
93
|
-
|
94
|
-
Blacklight.config[:search_fields] << {:key => "only_in_cql", :show_in_simple_select => false, :local_solr_parameters => { :qf => "$my_special_qf"}}
|
95
|
-
|
96
|
-
As in the example above, you may want to use :local_solr_parameters referencing dollar-sign parameters that will be defined in your solrconfig.xml and de-referenced by Solr. This will keep your CQL-generated Solr querries a lot more readable in your logs and debugging. However, this feature is not available in Blacklight 2.5 (edge, or future 2.6).
|
97
|
-
|
98
|
-
Simply supplying literal values in :solr_paramaters is also supported and will work fine, it will just result in very long search querries in your solr query log.
|
99
|
-
|
100
|
-
== CQL context set prefixes
|
101
|
-
|
102
|
-
You can change the CQL "context set" prefix used for specifying a CQL index that is a direct solr field, or a Blacklight dismax configured field. In a Rails initializer:
|
103
|
-
|
104
|
-
CqlRuby.to_solr_defaults[:solr_field_prefix] = "my_solr"
|
105
|
-
CqlRuby.to_solr_defaults[:blacklight_field_prefix] = "my_blacklight_fields"
|
106
|
-
|
107
|
-
== Defaults from CqlRuby for direct solr indexed field querries.
|
108
|
-
|
109
|
-
For direct-solr-field operations, there are additional defaults that can be set, supported by CqlRuby. See: http://cql-ruby.rubyforge.org/svn/trunk/lib/cql_ruby/cql_to_solr.rb
|
110
|
-
|
111
|
-
Eg:
|
112
|
-
|
113
|
-
CqlRuby.to_solr_defaults[:default_index] = "solr_index"
|
114
|
-
CqlRuby.to_solr_defaults[:all_index] = "solr_mega_index"
|
115
|
-
CqlRuby.to_solr_defaults[:default_relation] = "cql.any"
|
116
|
-
|
117
|
-
= TO DO
|
118
|
-
|
119
|
-
* Support more CQL relations on blacklight dismax fields. Right now only dismax queries are supported. We could also support:
|
120
|
-
* cql.all (set mm to 100%)
|
121
|
-
* cql.adj (phrase search with qs set to 0)
|
122
|
-
* cql.any
|
123
|
-
* range querries on dismax fields? Maybe. <, <=, >, >=, within
|
124
|
-
* <> on dismax fields, similar to how it works on raw solr.
|
125
|
-
* Is there a simple way to support CQL PROX boolean operator? Not sure. That's a weird operator in CQL, it makes it possible to specify things which make no sense, like onefield = val PROX anotherfield=val2
|
126
|
-
* Support CQL sortBy clauses mapped to Blacklight sort param. We can't tell which solr fields are available for sorting solely from luke, will need additional config to advertise in Explain.
|
127
|
-
* Add CQL relation modifiers on solr.dismax that let you specify arbitrary solr/dismax query parameters. (Add to solr context set too).
|
128
|
-
* Support relation modifier on cql.adj that maps to qs
|
129
|
-
* support CQL context set 'fuzzy' modifier, to have some effect on mm, ps, qs, etc.
|
130
|
-
* *Big one*: Figure out how to embed the explain and advertise the CQL in the BL OpenSearch description (including OpenSearch response in Atom). Tricky from BL architecture to inject this into BL, also some dispute about the best way for the actual XML to look to support this.
|
131
|
-
|
132
|
-
= Use without Blacklight?
|
133
|
-
|
134
|
-
Most of the code in this plugin was written to potentially be useful in other projects, not Blacklight, not neccesarily even Rails. However, the gem initialization code assumes Blacklight in order to insert it's hooks into Blacklight properly. This can probably be refactored to make it easier to use this gem in a non-BL or even non-Rails app, let me know if you are someone who has an actual need/plan for this, and I can possibly help.
|
135
|
-
|
136
|
-
= Acknolwedgements
|
137
|
-
|
138
|
-
Thanks to Chick Markley for writing the CqlRuby gem that provides the fundamental functionality here, and for making me a committer on the project. Thanks to Mike Taylor for writing the original Java CQL parser that Chick's work was based on.
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
Copyright 2010 Jonathan Rochkind/Johns Hopkins University, released under the MIT license
|
data/Rakefile
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'rake/testtask'
|
3
|
-
require 'rake/rdoctask'
|
4
|
-
|
5
|
-
desc 'Default: run unit tests.'
|
6
|
-
task :default => :test
|
7
|
-
|
8
|
-
desc 'Test the blacklight_cql plugin.'
|
9
|
-
Rake::TestTask.new(:test) do |t|
|
10
|
-
t.libs << 'lib'
|
11
|
-
t.libs << 'test'
|
12
|
-
t.pattern = 'test/**/*_test.rb'
|
13
|
-
t.verbose = true
|
14
|
-
end
|
15
|
-
|
16
|
-
desc 'Generate documentation for the blacklight_cql plugin.'
|
17
|
-
Rake::RDocTask.new(:rdoc) do |rdoc|
|
18
|
-
rdoc.rdoc_dir = 'rdoc'
|
19
|
-
rdoc.title = 'Blacklight-cql'
|
20
|
-
rdoc.options << '--line-numbers' << '--inline-source'
|
21
|
-
rdoc.rdoc_files.include('README')
|
22
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
23
|
-
end
|
24
|
-
|
25
|
-
begin
|
26
|
-
require 'jeweler'
|
27
|
-
Jeweler::Tasks.new do |gemspec|
|
28
|
-
gemspec.name = "blacklight_cql"
|
29
|
-
gemspec.summary = "Add CQL query support to a Blacklight app"
|
30
|
-
gemspec.description = "May have parts that can be used outside a Blacklight app too with a big of refactoring, let me know if interested."
|
31
|
-
gemspec.email = "rochkind@jhu.edu"
|
32
|
-
gemspec.homepage = "http://github.com/projectblacklight/blacklight_cql"
|
33
|
-
gemspec.authors = ["Jonathan Rochkind"]
|
34
|
-
|
35
|
-
gemspec.add_dependency("cql-ruby", ">=0.8.1")
|
36
|
-
|
37
|
-
gemspec.add_development_dependency("markup_validity")
|
38
|
-
end
|
39
|
-
Jeweler::GemcutterTasks.new
|
40
|
-
rescue LoadError
|
41
|
-
puts "Jeweler not available. Install it with: gem install jeweler"
|
42
|
-
end
|
43
|
-
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.9.1
|
data/init.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
File.dirname(__FILE__) + "/rails/init".
|
data/install.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# Install hook code here
|
data/rails/init.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
# Include hook code here
|
2
|
-
require 'cql_ruby'
|
3
|
-
require 'blacklight_cql'
|
4
|
-
require 'dispatcher'
|
5
|
-
|
6
|
-
|
7
|
-
# Call in after_initialze to make sure the default search_fields are
|
8
|
-
# already created, AND the local app has had the opportunity to customize
|
9
|
-
# our placeholder search_field.
|
10
|
-
config.after_initialize do
|
11
|
-
Blacklight.config[:search_fields] << BlacklightCql::SolrHelperExtension.pseudo_search_field
|
12
|
-
end
|
13
|
-
|
14
|
-
# Wrapping in Dispatcher.to_prepare will, theoretically, take care of things
|
15
|
-
# working properly even in development mode with cache_classes=false (per-request
|
16
|
-
# class reloading).
|
17
|
-
Dispatcher.to_prepare("blacklight_cql.setup") do
|
18
|
-
|
19
|
-
|
20
|
-
#Check in case CatalogController _hasn't_ really been re-loaded
|
21
|
-
unless (CatalogController.kind_of?( BlacklightCql::SolrHelperExtension ))
|
22
|
-
# Will over-ride #solr_params to deal with CQL
|
23
|
-
CatalogController.send(:include, BlacklightCql::SolrHelperExtension)
|
24
|
-
|
25
|
-
# Will over-ride helper methods for search form select, to ensure
|
26
|
-
# query is echo'd properly.
|
27
|
-
CatalogController.send(:helper, BlacklightCql::TemplateHelperExtension)
|
28
|
-
end
|
29
|
-
|
30
|
-
|
31
|
-
end
|
32
|
-
|
data/uninstall.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# Uninstall hook code here
|