blacklight_advanced_search 2.1.1 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -1
- data/.travis.yml +16 -0
- data/Gemfile +12 -2
- data/README.rdoc +25 -11
- data/Rakefile +15 -22
- data/VERSION +1 -1
- data/app/controllers/blacklight_advanced_search/advanced_controller.rb +12 -6
- data/app/helpers/advanced_helper.rb +1 -11
- data/app/views/advanced/_facet_limit.html.erb +1 -1
- data/app/views/advanced/index.html.erb +1 -3
- data/app/views/blacklight_advanced_search/_facet_limit.html.erb +1 -1
- data/blacklight_advanced_search.gemspec +2 -5
- data/config/jetty.yml +4 -0
- data/config/routes.rb +1 -1
- data/lib/blacklight_advanced_search/controller.rb +8 -2
- data/lib/blacklight_advanced_search/parse_basic_q.rb +1 -1
- data/lib/blacklight_advanced_search/render_constraints_override.rb +5 -1
- data/lib/generators/blacklight_advanced_search/assets_generator.rb +22 -5
- data/lib/generators/blacklight_advanced_search/blacklight_advanced_search_generator.rb +8 -2
- data/lib/generators/blacklight_advanced_search/templates/advanced_controller.rb +4 -3
- data/lib/parsing_nesting/tree.rb +17 -19
- data/spec/{acceptance → features}/blacklight_advanced_search_form_spec.rb +2 -22
- data/spec/parsing_nesting/to_solr_spec.rb +25 -11
- data/spec/spec_helper.rb +3 -8
- data/spec/test_app_templates/Gemfile.extra +14 -0
- data/spec/test_app_templates/app/controllers/catalog_controller.rb +25 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +34 -0
- data/spec/test_app_templates/lib/tasks/blacklight_test_app.rake +14 -0
- metadata +53 -86
- checksums.yaml +0 -7
- data/install.rb +0 -0
- data/lib/generators/blacklight_advanced_search/templates/_search_form.html.erb +0 -23
- data/spec/internal/app/controllers/application_controller.rb +0 -6
- data/spec/internal/app/models/solr_document.rb +0 -3
- data/spec/internal/config/database.yml +0 -3
- data/spec/internal/config/routes.rb +0 -6
- data/spec/internal/config/solr.yml +0 -18
- data/spec/internal/db/combustion_test.sqlite +0 -0
- data/spec/internal/db/schema.rb +0 -53
- data/spec/internal/log/.gitignore +0 -1
- data/spec/internal/public/favicon.ico +0 -0
- data/uninstall.rb +0 -1
data/.gitignore
CHANGED
data/.travis.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
notifications:
|
2
|
+
email: false
|
3
|
+
|
4
|
+
rvm:
|
5
|
+
- 2.1.0
|
6
|
+
- 2.0.0
|
7
|
+
- 1.9.3
|
8
|
+
- jruby-19mode
|
9
|
+
|
10
|
+
notifications:
|
11
|
+
irc: "irc.freenode.org#blacklight"
|
12
|
+
email:
|
13
|
+
- blacklight-commits@googlegroups.com
|
14
|
+
env:
|
15
|
+
global:
|
16
|
+
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
data/Gemfile
CHANGED
@@ -2,5 +2,15 @@ source 'http://rubygems.org'
|
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
|
6
|
-
gem
|
5
|
+
group :test do
|
6
|
+
gem "bootstrap-sass"
|
7
|
+
gem 'turbolinks'
|
8
|
+
end
|
9
|
+
|
10
|
+
gem 'activerecord-jdbcsqlite3-adapter', platform: :jruby
|
11
|
+
gem 'sqlite3', platform: :ruby
|
12
|
+
gem 'jquery-rails'
|
13
|
+
|
14
|
+
if File.exists?('spec/test_app_templates/Gemfile.extra')
|
15
|
+
eval File.read('spec/test_app_templates/Gemfile.extra'), nil, 'spec/test_app_templates/Gemfile.extra'
|
16
|
+
end
|
data/README.rdoc
CHANGED
@@ -1,12 +1,19 @@
|
|
1
1
|
This is an advanced search plugin for Blacklight ( http://www.projectblacklight.org ).
|
2
2
|
|
3
|
-
==
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
3
|
+
== Blacklight version compatibility
|
4
|
+
|
5
|
+
This is a plugin for Blacklight: http://github.com/projectblacklight/blacklight
|
6
|
+
|
7
|
+
It has been hard to keep track of which versions of `blacklight_advanced_search`
|
8
|
+
work with which versions of `blacklight`. Some notes:
|
9
|
+
|
10
|
+
* versions 5.x of Advanced Search plugin should work with Blacklight >= 5.1 and < 6 -- we now synchronize the _major_ version number between `blacklight` and `blacklight_advanced_search`.
|
11
|
+
* version 2.2 of `blacklight_advanced_search` should work with `blacklight` 4.x.
|
12
|
+
* versions `1.2.*` of Advanced Search plugin can work with blacklight 3.2.2 through latest 3.2.x
|
13
|
+
* 1.2.0 was an aborted version, don't use it, if you did, re-do your configuration according to current instructions and delete any local ./app/controllers/advanced_controller.rb file.
|
14
|
+
* advanced search 1.1.x versions will work with Blacklights 3.0.x through 3.1.x
|
15
|
+
* advanced search plugin latest 0.X.X version will work with Blacklight 2.9/Rails2.
|
16
|
+
* Older tagged versions of Advanced Search may work with even older BL.
|
10
17
|
|
11
18
|
== Installation:
|
12
19
|
|
@@ -27,13 +34,14 @@ You may want to `include BlacklightAdvancedSearch::ParseBasicQ` in your Catalog
|
|
27
34
|
|
28
35
|
== Accessing
|
29
36
|
|
30
|
-
The advanced search form will be available in your app at /advanced
|
37
|
+
The advanced search form will be available in your app at /advanced, and in your app using
|
38
|
+
routing helper `advanced_search_path`.
|
31
39
|
|
32
|
-
|
40
|
+
advanced_search_path
|
33
41
|
|
34
42
|
You can also send the advanced search form url parameters representing a search, to have the form add on additional 'advanced' criteria to the search. For example:
|
35
43
|
|
36
|
-
|
44
|
+
advanced_search_path( params )
|
37
45
|
|
38
46
|
By default there won't be any links in your application to the search form. If you've heavily customized your app, you can put them wherever you want as above.
|
39
47
|
|
@@ -148,11 +156,17 @@ By default, the advanced search form will show as limits whatever facets are con
|
|
148
156
|
Complete list of keys that can be supplied inside your configure_blacklight `advanced_search` block:
|
149
157
|
|
150
158
|
[:qt]
|
151
|
-
Solr request handler to use for any search that includes advanced search criteria. Defaults to what the application has set as
|
159
|
+
Solr request handler to use for any search that includes advanced search criteria. Defaults to what the application has set as blacklight_config.default_solr_params[:qt]
|
152
160
|
[:url_key]
|
153
161
|
Key to use in application URLs to indicate advanced search is included in a query, defaults to "advanced". URLs will have "&search_field=[url key]".
|
154
162
|
[:form_solr_paramters]
|
155
163
|
A hash of solr parameters which will be included in Solr request sent before display of advanced search form. Can be used to set facet parameters for advanced search form display.
|
164
|
+
[:query_parser]
|
165
|
+
advanced searches are translated to solr nested queries, where the inner queries are of a dismax-type.
|
166
|
+
By default, they are actually specifically 'dismax', but you can set :query_parser to 'edismax' instead.
|
167
|
+
This may make additional features available like * wildcards in advanced searches; but it may also
|
168
|
+
cause some user query elements to be interpreted as operators for edismax when they
|
169
|
+
were intended as literals. Somewhat experimental. See Github issues #11 and #14.
|
156
170
|
|
157
171
|
|
158
172
|
== Translation to Solr Query, technical details
|
data/Rakefile
CHANGED
@@ -5,41 +5,33 @@ require 'rdoc/task'
|
|
5
5
|
require 'bundler/setup'
|
6
6
|
Bundler::GemHelper.install_tasks
|
7
7
|
|
8
|
+
ZIP_URL = "https://github.com/projectblacklight/blacklight-jetty/archive/v4.0.0.zip"
|
9
|
+
APP_ROOT = File.dirname(__FILE__)
|
10
|
+
|
8
11
|
require 'rspec/core/rake_task'
|
12
|
+
require 'engine_cart/rake_task'
|
9
13
|
|
14
|
+
require 'jettywrapper'
|
10
15
|
require 'blacklight'
|
11
16
|
import File.join(Blacklight.root, 'lib', 'railties', 'solr_marc.rake')
|
12
17
|
|
13
|
-
task :default => :
|
18
|
+
task :default => :ci
|
14
19
|
|
15
20
|
desc "Run specs"
|
16
21
|
RSpec::Core::RakeTask.new do |t|
|
17
22
|
|
18
23
|
end
|
19
24
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
Combustion.initialize!
|
27
|
-
unless ENV['environment'] == 'test'
|
28
|
-
exec("rake ci environment=test")
|
25
|
+
desc "Load fixtures"
|
26
|
+
task :fixtures => ['engine_cart:generate'] do
|
27
|
+
within_test_app do
|
28
|
+
system "rake solr:marc:index_test_data RAILS_ENV=test"
|
29
|
+
abort "Error running fixtures" unless $?.success?
|
30
|
+
end
|
29
31
|
end
|
30
32
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
Blacklight::Jetty.start(["--save_location=jetty", "--force"])
|
35
|
-
|
36
|
-
ENV['RAILS_ENV'] = 'test'
|
37
|
-
ENV['CONFIG_PATH'] = File.expand_path(File.join(Blacklight.root, 'lib', 'generators', 'blacklight', 'templates', 'config', 'SolrMarc', 'config-test.properties'))
|
38
|
-
ENV['SOLRMARC_JAR_PATH'] = File.expand_path(File.join(Blacklight.root, 'lib', 'SolrMarc.jar'))
|
39
|
-
ENV['SOLR_PATH'] = File.expand_path(File.join('jetty', 'solr'))
|
40
|
-
ENV['SOLR_WAR_PATH'] = File.expand_path(File.join('jetty', 'webapps', 'solr.war'))
|
41
|
-
Rake::Task['solr:marc:index_test_data'].invoke
|
42
|
-
|
33
|
+
desc "Execute Continuous Integration build"
|
34
|
+
task :ci => ['jetty:clean', 'engine_cart:generate'] do
|
43
35
|
|
44
36
|
require 'jettywrapper'
|
45
37
|
jetty_params = {
|
@@ -51,6 +43,7 @@ Combustion.initialize!
|
|
51
43
|
}
|
52
44
|
|
53
45
|
error = Jettywrapper.wrap(jetty_params) do
|
46
|
+
Rake::Task['fixtures'].invoke
|
54
47
|
Rake::Task['spec'].invoke
|
55
48
|
end
|
56
49
|
raise "test failures: #{error}" if error
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.2.0
|
@@ -25,6 +25,7 @@ class BlacklightAdvancedSearch::AdvancedController < CatalogController
|
|
25
25
|
trimmed_params.delete(:f_inclusive) # adv facets
|
26
26
|
|
27
27
|
search_context_params = solr_search_params(trimmed_params)
|
28
|
+
|
28
29
|
# Don't want to include the 'q' from basic search in our search
|
29
30
|
# context. Kind of hacky becuase solr_search_params insists on
|
30
31
|
# using controller.params, not letting us over-ride.
|
@@ -32,11 +33,10 @@ class BlacklightAdvancedSearch::AdvancedController < CatalogController
|
|
32
33
|
search_context_params.delete("q")
|
33
34
|
|
34
35
|
# Also delete any facet-related params, or anything else
|
35
|
-
# we want to set ourselves
|
36
|
-
# defaults.
|
36
|
+
# we want to set ourselves
|
37
37
|
search_context_params.delete_if do |k, v|
|
38
38
|
k = k.to_s
|
39
|
-
(["facet.limit", "facet.sort", "f", "facets", "facet.fields", "
|
39
|
+
(["facet.limit", "facet.sort", "f", "facets", "facet.fields", "per_page"].include?(k) ||
|
40
40
|
k =~ /f\..+\.facet\.limit/ ||
|
41
41
|
k =~ /f\..+\.facet\.sort/
|
42
42
|
)
|
@@ -45,12 +45,18 @@ class BlacklightAdvancedSearch::AdvancedController < CatalogController
|
|
45
45
|
|
46
46
|
input = HashWithIndifferentAccess.new
|
47
47
|
input.merge!( search_context_params )
|
48
|
+
|
49
|
+
input[:per_page] = 0 # force
|
50
|
+
|
51
|
+
# force if set
|
52
|
+
input[:qt] = blacklight_config.advanced_search[:qt] if blacklight_config.advanced_search[:qt]
|
48
53
|
|
49
|
-
input.merge!( :qt => blacklight_config.advanced_search[:qt] || blacklight_config.default_qt , :per_page => 0)
|
50
54
|
input.merge!( blacklight_config.advanced_search[:form_solr_parameters] ) if blacklight_config.advanced_search[:form_solr_parameters]
|
55
|
+
|
56
|
+
# ensure empty query is all records, to fetch available facets on entire corpus
|
51
57
|
input[:q] ||= '{!lucene}*:*'
|
52
58
|
|
53
|
-
|
54
|
-
find(input.to_hash)
|
59
|
+
# first arg nil, use default search path.
|
60
|
+
find(nil, input.to_hash)
|
55
61
|
end
|
56
62
|
end
|
@@ -34,18 +34,8 @@ module AdvancedHelper
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def search_fields_for_advanced_search
|
37
|
-
# If we could count on 1.9.3 with ordered hashes and
|
38
|
-
# Hash#select that worked reasonably, this would be trivial.
|
39
|
-
# instead, a way compat with 1.8.7 and 1.9.x both.
|
40
37
|
@search_fields_for_advanced_search ||= begin
|
41
|
-
|
42
|
-
hash = blacklight_config.search_fields.class.new
|
43
|
-
|
44
|
-
blacklight_config.search_fields.each_pair do |key, value|
|
45
|
-
hash[key] = value unless value.include_in_advanced_search == false
|
46
|
-
end
|
47
|
-
|
48
|
-
hash
|
38
|
+
blacklight_config.search_fields.select { |k,v| v.include_in_advanced_search or v.include_in_advanced_search.nil? }
|
49
39
|
end
|
50
40
|
end
|
51
41
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<ul>
|
2
2
|
<% display_facet.items.each do |item| -%>
|
3
3
|
<li>
|
4
|
-
<%= label_tag "f_inclusive_#{solr_field}[#{item.value.to_sym}]", (check_box_tag "f_inclusive[#{solr_field}][#{item.value.to_sym}]", 1, facet_value_checked?(solr_field, item.value)) + content_tag(:span, item.value, :class => 'facet-value') + " (#{
|
4
|
+
<%= label_tag "f_inclusive_#{solr_field}[#{item.value.to_sym}]", (check_box_tag "f_inclusive[#{solr_field}][#{item.value.to_sym}]", 1, facet_value_checked?(solr_field, item.value)) + content_tag(:span, item.value, :class => 'facet-value') + " (#{number_with_delimiter item.hits})".html_safe, :class => 'checkbox' %>
|
5
5
|
</li>
|
6
6
|
<% end -%>
|
7
7
|
</ul>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<h4>Any of:</h4>
|
4
4
|
<ul>
|
5
5
|
<% @advanced_query.filters[solr_field].each do |value| %>
|
6
|
-
<li><span class="selected"><%= h(value) %></span> <%= link_to(content_tag(:i, '', :class => "icon-remove") + content_tag(:span, '[remove]', :class => 'hide-text'),
|
6
|
+
<li><span class="selected"><%= h(value) %></span> <%= link_to(content_tag(:i, '', :class => "icon-remove") + content_tag(:span, '[remove]', :class => 'hide-text'), remove_advanced_facet_param(solr_field, value, params), :class=>"remove") %></li>
|
7
7
|
<% end %>
|
8
8
|
</ul>
|
9
9
|
</div>
|
@@ -22,10 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_dependency "parslet"
|
23
23
|
|
24
24
|
s.add_development_dependency "rails"
|
25
|
-
s.add_development_dependency "combustion"
|
26
25
|
s.add_development_dependency "rspec-rails"
|
27
|
-
s.add_development_dependency "
|
28
|
-
s.add_development_dependency
|
29
|
-
s.add_development_dependency 'launchy'
|
30
|
-
s.add_development_dependency 'jettywrapper'
|
26
|
+
s.add_development_dependency 'jettywrapper', ">= 1.4.2"
|
27
|
+
s.add_development_dependency 'engine_cart'
|
31
28
|
end
|
data/config/jetty.yml
ADDED
data/config/routes.rb
CHANGED
@@ -8,7 +8,9 @@ module BlacklightAdvancedSearch::Controller
|
|
8
8
|
included do
|
9
9
|
# default adv config values
|
10
10
|
self.blacklight_config.advanced_search ||= Blacklight::OpenStructWithHashAccess.new
|
11
|
+
#self.blacklight_config.advanced_search[:qt] ||= 'advanced'
|
11
12
|
self.blacklight_config.advanced_search[:url_key] ||= 'advanced'
|
13
|
+
self.blacklight_config.advanced_search[:query_parser] ||= 'dismax'
|
12
14
|
self.blacklight_config.advanced_search[:form_solr_parameters] ||= {}
|
13
15
|
|
14
16
|
|
@@ -18,8 +20,13 @@ module BlacklightAdvancedSearch::Controller
|
|
18
20
|
# Display advanced search constraints properly
|
19
21
|
helper BlacklightAdvancedSearch::RenderConstraintsOverride
|
20
22
|
helper BlacklightAdvancedSearch::CatalogHelperOverride
|
23
|
+
helper_method :is_advanced_search?
|
21
24
|
end
|
22
25
|
|
26
|
+
def is_advanced_search? req_params = params
|
27
|
+
(req_params[:search_field] == self.blacklight_config.advanced_search[:url_key]) ||
|
28
|
+
req_params[:f_inclusive]
|
29
|
+
end
|
23
30
|
|
24
31
|
# this method should get added into the solr_search_params_logic
|
25
32
|
# list, in a position AFTER normal query handling (:add_query_to_solr),
|
@@ -30,8 +37,7 @@ module BlacklightAdvancedSearch::Controller
|
|
30
37
|
# map that to solr #q, over-riding whatever some other logic may have set, yeah.
|
31
38
|
# the hint right now is :search_field request param is set to a magic
|
32
39
|
# key. OR of :f_inclusive is set for advanced params, we need processing too.
|
33
|
-
if
|
34
|
-
req_params[:f_inclusive] )
|
40
|
+
if is_advanced_search? req_params
|
35
41
|
# Set this as a controller instance variable, not sure if some views/helpers depend on it. Better to leave it as a local variable
|
36
42
|
# if not, more investigation later.
|
37
43
|
@advanced_query = BlacklightAdvancedSearch::QueryParser.new(req_params, self.blacklight_config )
|
@@ -40,7 +40,7 @@ module BlacklightAdvancedSearch::ParseBasicQ
|
|
40
40
|
# See if we can parse it, if we can't, we're going to give up
|
41
41
|
# and just allow basic search, perhaps with a warning.
|
42
42
|
begin
|
43
|
-
adv_search_params = ParsingNesting::Tree.parse(req_params[:q]).to_single_query_params( solr_local_params )
|
43
|
+
adv_search_params = ParsingNesting::Tree.parse(req_params[:q], blacklight_config.advanced_search[:query_parser]).to_single_query_params( solr_local_params )
|
44
44
|
|
45
45
|
BlacklightAdvancedSearch.deep_merge!(solr_parameters, solr_direct_params)
|
46
46
|
BlacklightAdvancedSearch.deep_merge!(solr_parameters, adv_search_params)
|
@@ -4,7 +4,11 @@
|
|
4
4
|
module BlacklightAdvancedSearch::RenderConstraintsOverride
|
5
5
|
|
6
6
|
def query_has_constraints?(localized_params = params)
|
7
|
-
|
7
|
+
if is_advanced_search? localized_params
|
8
|
+
true
|
9
|
+
else
|
10
|
+
!(localized_params[:q].blank? and localized_params[:f].blank? and localized_params[:f_inclusive].blank?)
|
11
|
+
end
|
8
12
|
end
|
9
13
|
|
10
14
|
#Over-ride of Blacklight method, provide advanced constraints if needed,
|
@@ -15,21 +15,38 @@ module BlacklightAdvancedSearch
|
|
15
15
|
class AssetsGenerator < Rails::Generators::Base
|
16
16
|
source_root File.join(BlacklightAdvancedSearch::Engine.root, 'app', 'assets')
|
17
17
|
|
18
|
-
def
|
19
|
-
|
18
|
+
def css_asset
|
19
|
+
application_css_location = Dir["app/assets/stylesheets/application{.css,.scss,.css.scss}"].first
|
20
|
+
|
21
|
+
unless application_css_location
|
22
|
+
say_status "skipped", "Can not find an application.css, did not insert our require", :red
|
23
|
+
return
|
24
|
+
end
|
25
|
+
|
26
|
+
original_css = File.binread(application_css_location)
|
20
27
|
if original_css.include?("require 'blacklight_advanced_search'")
|
21
28
|
say_status("skipped", "insert into app/assets/stylesheets/application.css", :yellow)
|
22
29
|
else
|
23
|
-
insert_into_file
|
30
|
+
insert_into_file application_css_location, :before => "*/" do
|
24
31
|
"\n *= require 'blacklight_advanced_search'\n\n"
|
25
32
|
end
|
26
33
|
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
def js_asset
|
38
|
+
application_js_location = Dir["app/assets/javascripts/application{.js,.coffee,.js.coffee}"].first
|
39
|
+
|
40
|
+
unless application_js_location
|
41
|
+
say_status "skipped", "Can not find an application.js, did not insert our require", :red
|
42
|
+
return
|
43
|
+
end
|
27
44
|
|
28
|
-
original_js = File.binread(
|
45
|
+
original_js = File.binread(application_js_location)
|
29
46
|
if original_js.include?("require 'blacklight_advanced_search'")
|
30
47
|
say_status("skipped", "insert into app/assets/javascripts/application.js", :yellow)
|
31
48
|
else
|
32
|
-
insert_into_file
|
49
|
+
insert_into_file application_js_location, :after => %r{//= require ['"]?jquery['"]?$} do
|
33
50
|
"\n//= require 'blacklight_advanced_search'\n\n"
|
34
51
|
end
|
35
52
|
end
|
@@ -10,8 +10,14 @@ class BlacklightAdvancedSearchGenerator < Rails::Generators::Base
|
|
10
10
|
|
11
11
|
|
12
12
|
def install_localized_search_form
|
13
|
-
if options[:force] or yes?("Install local search form with advanced link?")
|
14
|
-
|
13
|
+
if options[:force] or yes?("Install local search form with advanced link? (y/N)", :green)
|
14
|
+
# We're going to copy the search from from actual currently loaded
|
15
|
+
# Blacklight into local app as custom local override -- but add our link at the end too.
|
16
|
+
source_file = File.read(File.join(Blacklight.root, "app/views/catalog/_search_form.html.erb"))
|
17
|
+
|
18
|
+
new_file_contents = source_file + "\n\n<%= link_to 'More options', advanced_search_path(params), :class=>'advanced_search'%>"
|
19
|
+
|
20
|
+
create_file("app/views/catalog/_search_form.html.erb", new_file_contents)
|
15
21
|
end
|
16
22
|
end
|
17
23
|
|
@@ -1,13 +1,14 @@
|
|
1
1
|
class AdvancedController < BlacklightAdvancedSearch::AdvancedController
|
2
2
|
|
3
3
|
blacklight_config.configure do |config|
|
4
|
-
# name of Solr request handler, leave unset to use the same one
|
5
|
-
|
4
|
+
# name of Solr request handler, leave unset to use the same one your Blacklight
|
5
|
+
# is ordinarily using (recommended if possible)
|
6
|
+
# config.advanced_search.qt = 'advanced'
|
6
7
|
|
7
8
|
##
|
8
9
|
# The advanced search form displays facets as a limit option.
|
9
10
|
# By default it will use whatever facets, if any, are returned
|
10
|
-
# by the Solr
|
11
|
+
# by the Solr request handler in use. However, you can use
|
11
12
|
# this config option to have it request other facet params than
|
12
13
|
# default in the Solr request handler, in desired.
|
13
14
|
config.advanced_search.form_solr_parameters = {}
|
data/lib/parsing_nesting/tree.rb
CHANGED
@@ -22,8 +22,8 @@ module ParsingNesting::Tree
|
|
22
22
|
#
|
23
23
|
# the #negate method was an experiment in transforming parse tree in
|
24
24
|
# place, but isn't being used. But it's left as a sign post.
|
25
|
-
def self.parse(string)
|
26
|
-
to_node_tree(ParsingNesting::Grammar.new.parse(string))
|
25
|
+
def self.parse(string, query_parser='dismax')
|
26
|
+
to_node_tree(ParsingNesting::Grammar.new.parse(string), query_parser)
|
27
27
|
end
|
28
28
|
|
29
29
|
|
@@ -31,25 +31,25 @@ module ParsingNesting::Tree
|
|
31
31
|
# manner in which I'm parsing to Parslet labelled hash isn't exactly what
|
32
32
|
# Parslet Transform is set up to work with, I couldn't figure it out. But
|
33
33
|
# easy enough to do 'manually'.
|
34
|
-
def self.to_node_tree(tree)
|
34
|
+
def self.to_node_tree(tree, query_parser)
|
35
35
|
if tree.kind_of? Array
|
36
36
|
# at one point I was normalizing top-level lists of one item to just
|
37
37
|
# be that item, no list wrapper. But having the list wrapper
|
38
38
|
# at the top level is actually useful for Solr output.
|
39
|
-
List.new( tree.collect {|i| to_node_tree(i)})
|
39
|
+
List.new( tree.collect {|i| to_node_tree(i, query_parser)}, query_parser)
|
40
40
|
elsif tree.kind_of? Hash
|
41
41
|
if list = tree[:list]
|
42
|
-
List.new( list.collect {|i| to_node_tree(i)} )
|
42
|
+
List.new( list.collect {|i| to_node_tree(i, query_parser)}, query_parser)
|
43
43
|
elsif tree.has_key?(:and_list)
|
44
|
-
AndList.new( tree[:and_list].collect{|i| to_node_tree(i) } )
|
44
|
+
AndList.new( tree[:and_list].collect{|i| to_node_tree(i, query_parser) }, query_parser)
|
45
45
|
elsif tree.has_key?(:or_list)
|
46
|
-
OrList.new( tree[:or_list].collect{|i| to_node_tree(i) } )
|
46
|
+
OrList.new( tree[:or_list].collect{|i| to_node_tree(i, query_parser) }, query_parser )
|
47
47
|
elsif not_payload = tree[:not_expression]
|
48
|
-
NotExpression.new( to_node_tree(not_payload) )
|
48
|
+
NotExpression.new( to_node_tree(not_payload, query_parser) )
|
49
49
|
elsif tree.has_key?(:mandatory)
|
50
|
-
MandatoryClause.new( to_node_tree(tree[:mandatory]
|
50
|
+
MandatoryClause.new( to_node_tree(tree[:mandatory], query_parser))
|
51
51
|
elsif tree.has_key?(:excluded)
|
52
|
-
ExcludedClause.new( to_node_tree(tree[:excluded]))
|
52
|
+
ExcludedClause.new( to_node_tree(tree[:excluded], query_parser))
|
53
53
|
elsif phrase = tree[:phrase]
|
54
54
|
Phrase.new( phrase )
|
55
55
|
elsif tree.has_key?(:token)
|
@@ -87,7 +87,7 @@ module ParsingNesting::Tree
|
|
87
87
|
|
88
88
|
# if it's pure negative, we need to transform
|
89
89
|
if embeddables.find_all{|n| n.kind_of?(ExcludedClause)}.length == embeddables.length
|
90
|
-
negated = NotExpression.new( List.new(embeddables.collect {|n| n.operand}))
|
90
|
+
negated = NotExpression.new( List.new(embeddables.collect {|n| n.operand}, options[:force_deftype] ))
|
91
91
|
solr_params = solr_params.merge(:mm => "1")
|
92
92
|
return negated.to_query(solr_params)
|
93
93
|
else
|
@@ -103,8 +103,7 @@ module ParsingNesting::Tree
|
|
103
103
|
|
104
104
|
end
|
105
105
|
end
|
106
|
-
|
107
|
-
|
106
|
+
|
108
107
|
# Pass in nil 2nd argument if you DON'T want to embed
|
109
108
|
# "!dismax" in your local params. Used by #to_single_query_params
|
110
109
|
def build_local_params(hash = {}, force_deftype = "dismax")
|
@@ -135,7 +134,9 @@ module ParsingNesting::Tree
|
|
135
134
|
|
136
135
|
class List < Node
|
137
136
|
attr_accessor :list
|
138
|
-
|
137
|
+
attr_reader :query_parser
|
138
|
+
def initialize(aList, query_parser)
|
139
|
+
@query_parser = query_parser
|
139
140
|
self.list = aList
|
140
141
|
end
|
141
142
|
def can_embed?
|
@@ -152,7 +153,7 @@ module ParsingNesting::Tree
|
|
152
153
|
(embeddable, gen_full_query) = list.partition {|i| i.respond_to?(:can_embed?) && i.can_embed?}
|
153
154
|
|
154
155
|
unless embeddable.empty?
|
155
|
-
queries << build_nested_query(embeddable, solr_params)
|
156
|
+
queries << build_nested_query(embeddable, solr_params, force_deftype: query_parser)
|
156
157
|
end
|
157
158
|
|
158
159
|
gen_full_query.each do |node|
|
@@ -185,7 +186,7 @@ module ParsingNesting::Tree
|
|
185
186
|
{
|
186
187
|
#build_local_params(solr_local_params, nil) + list.collect {|n| n.to_embed}.join(" "),
|
187
188
|
:q => build_nested_query(list, solr_local_params, :always_nested => false, :force_deftype => nil),
|
188
|
-
:defType =>
|
189
|
+
:defType => query_parser
|
189
190
|
}
|
190
191
|
else
|
191
192
|
# Can't be expressed in a single dismax, do it the normal way
|
@@ -199,7 +200,6 @@ module ParsingNesting::Tree
|
|
199
200
|
def negate
|
200
201
|
List.new(list.collect {|i| i.negate})
|
201
202
|
end
|
202
|
-
|
203
203
|
end
|
204
204
|
|
205
205
|
class AndList < List
|
@@ -355,8 +355,6 @@ module ParsingNesting::Tree
|
|
355
355
|
false
|
356
356
|
end
|
357
357
|
|
358
|
-
|
359
|
-
|
360
358
|
def negate
|
361
359
|
operand
|
362
360
|
end
|
@@ -2,27 +2,6 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe "Blacklight Advanced Search Form" do
|
4
4
|
before(:all) do
|
5
|
-
CatalogController.configure_blacklight do |config|
|
6
|
-
config.default_solr_params = {
|
7
|
-
:qt => 'search',
|
8
|
-
:rows => 10
|
9
|
-
}
|
10
|
-
|
11
|
-
config.add_facet_field 'language_facet'
|
12
|
-
|
13
|
-
config.add_search_field('title') do |field|
|
14
|
-
field.solr_local_parameters = { :qf => "title_t", :pf => "title_t"}
|
15
|
-
end
|
16
|
-
|
17
|
-
config.add_search_field('author') do |field|
|
18
|
-
field.solr_local_parameters = { :qf => "author_t", :pf => "author_t"}
|
19
|
-
end
|
20
|
-
|
21
|
-
config.add_search_field('dummy_field') do |field|
|
22
|
-
field.include_in_advanced_search = false
|
23
|
-
field.solr_local_parameters = { :qf => "author_t", :pf => "author_t"}
|
24
|
-
end
|
25
|
-
end
|
26
5
|
AdvancedController.copy_blacklight_config_from(CatalogController)
|
27
6
|
end
|
28
7
|
|
@@ -67,7 +46,8 @@ describe "Blacklight Advanced Search Form" do
|
|
67
46
|
|
68
47
|
it "scope searches to fields" do
|
69
48
|
fill_in "title", :with => "Medicine"
|
70
|
-
click_on "
|
49
|
+
click_on "advanced_search"
|
50
|
+
puts page.current_url
|
71
51
|
page.should have_content "Remove constraint Title: Medicine"
|
72
52
|
page.should have_content "2007020969"
|
73
53
|
end
|
@@ -8,8 +8,12 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|
8
8
|
#load '../../lib/parsing_nesting/tree.rb'
|
9
9
|
|
10
10
|
module SolrQuerySpecHelper
|
11
|
-
def parse(s)
|
12
|
-
|
11
|
+
def parse(s, arg=nil)
|
12
|
+
if arg
|
13
|
+
ParsingNesting::Tree.parse(s, arg)
|
14
|
+
else
|
15
|
+
ParsingNesting::Tree.parse(s)
|
16
|
+
end
|
13
17
|
end
|
14
18
|
|
15
19
|
# yields localparam string, and the actual internal query
|
@@ -65,15 +69,6 @@ describe "NestingParser" do
|
|
65
69
|
before do
|
66
70
|
@query = parse("one two three").to_query(:qf => "field field2^5", :pf=>"$pf_title")
|
67
71
|
end
|
68
|
-
|
69
|
-
it "should insist on dismax for nested query" do
|
70
|
-
query = parse("one two three").to_query(:defType => "field", :qf=>"$qf")
|
71
|
-
local_param_match(query) do |params, query|
|
72
|
-
params.should match(/^\!dismax /)
|
73
|
-
params.should_not match(/field/)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
72
|
it "should include LocalParams" do
|
78
73
|
local_param_match(@query) do |params, query|
|
79
74
|
params.should include("pf=$pf_title")
|
@@ -87,6 +82,25 @@ describe "NestingParser" do
|
|
87
82
|
end
|
88
83
|
end
|
89
84
|
end
|
85
|
+
|
86
|
+
describe "with custom qf" do
|
87
|
+
it "should insist on dismax for nested query" do
|
88
|
+
query = parse("one two three").to_query(:defType => "field", :qf=>"$qf")
|
89
|
+
local_param_match(query) do |params, query|
|
90
|
+
params.should match(/^\!dismax /)
|
91
|
+
params.should_not match(/field/)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should insist on edismax for nested query" do
|
96
|
+
query = parse("one two three", 'edismax').to_query(:defType => "field", :qf=>"$qf")
|
97
|
+
local_param_match(query) do |params, query|
|
98
|
+
params.should match(/^\!edismax qf=\$qf/)
|
99
|
+
params.should_not match(/field/)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
90
104
|
|
91
105
|
describe "with simple mandatory/excluded terms" do
|
92
106
|
before do
|
data/spec/spec_helper.rb
CHANGED
@@ -1,15 +1,10 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'combustion'
|
3
|
-
|
4
1
|
ENV["RAILS_ENV"] = "test"
|
5
2
|
|
6
|
-
require '
|
7
|
-
|
3
|
+
require 'engine_cart'
|
4
|
+
EngineCart.load_application!
|
8
5
|
|
9
|
-
class SolrDocument
|
10
|
-
include Blacklight::Solr::Document
|
11
|
-
end
|
12
6
|
|
7
|
+
require 'capybara/rspec'
|
13
8
|
require 'rspec/rails'
|
14
9
|
require 'capybara/rails'
|
15
10
|
|
@@ -0,0 +1,14 @@
|
|
1
|
+
platforms :jruby do
|
2
|
+
gem 'mediashelf-loggable', '>= 0.4.8'
|
3
|
+
gem 'therubyrhino'
|
4
|
+
end
|
5
|
+
|
6
|
+
group :test do
|
7
|
+
gem 'rspec-rails', '~> 2.13'
|
8
|
+
gem 'generator_spec'
|
9
|
+
gem 'capybara'
|
10
|
+
gem 'simplecov', :platform => :mri_19
|
11
|
+
end
|
12
|
+
|
13
|
+
gem 'jettywrapper', '>= 1.2.0'
|
14
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class CatalogController < ApplicationController
|
2
|
+
include Blacklight::Catalog
|
3
|
+
|
4
|
+
configure_blacklight do |config|
|
5
|
+
config.default_solr_params = {
|
6
|
+
:qt => 'search',
|
7
|
+
:rows => 10
|
8
|
+
}
|
9
|
+
|
10
|
+
config.add_facet_field 'language_facet'
|
11
|
+
|
12
|
+
config.add_search_field('title') do |field|
|
13
|
+
field.solr_local_parameters = { :qf => "title_t", :pf => "title_t"}
|
14
|
+
end
|
15
|
+
|
16
|
+
config.add_search_field('author') do |field|
|
17
|
+
field.solr_local_parameters = { :qf => "author_t", :pf => "author_t"}
|
18
|
+
end
|
19
|
+
|
20
|
+
config.add_search_field('dummy_field') do |field|
|
21
|
+
field.include_in_advanced_search = false
|
22
|
+
field.solr_local_parameters = { :qf => "author_t", :pf => "author_t"}
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
class TestAppGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path("../../../../test_app_templates", __FILE__)
|
5
|
+
|
6
|
+
def copy_blacklight_test_app_rake_task
|
7
|
+
copy_file "lib/tasks/blacklight_test_app.rake"
|
8
|
+
end
|
9
|
+
|
10
|
+
def remove_index
|
11
|
+
remove_file "public/index.html"
|
12
|
+
remove_file 'app/assets/images/rails.png'
|
13
|
+
end
|
14
|
+
|
15
|
+
def run_blacklight_generator
|
16
|
+
say_status("warning", "GENERATING BL", :yellow)
|
17
|
+
|
18
|
+
generate 'blacklight', '--marc'
|
19
|
+
end
|
20
|
+
|
21
|
+
def run_blacklight_advanced_search
|
22
|
+
generate 'blacklight_advanced_search', '--force'
|
23
|
+
end
|
24
|
+
|
25
|
+
def run_test_support_generator
|
26
|
+
say_status("warning", "GENERATING test_support", :yellow)
|
27
|
+
|
28
|
+
generate 'blacklight:test_support'
|
29
|
+
end
|
30
|
+
|
31
|
+
def copy_blacklight_catalog_controller
|
32
|
+
copy_file "app/controllers/catalog_controller.rb", :force => true
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rspec/core/rake_task'
|
2
|
+
|
3
|
+
desc "run the blacklight gem spec"
|
4
|
+
gem_home = File.expand_path('../../../../..', __FILE__)
|
5
|
+
|
6
|
+
namespace :blacklight_test_app do
|
7
|
+
|
8
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
9
|
+
t.pattern = gem_home + '/spec/**/*_spec.rb'
|
10
|
+
t.rspec_opts = "--colour"
|
11
|
+
t.ruby_opts = "-I#{gem_home}/spec"
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight_advanced_search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Jonathan Rochkind
|
@@ -9,11 +10,12 @@ authors:
|
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date:
|
13
|
+
date: 2014-03-05 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: blacklight
|
16
17
|
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
17
19
|
requirements:
|
18
20
|
- - ~>
|
19
21
|
- !ruby/object:Gem::Version
|
@@ -21,6 +23,7 @@ dependencies:
|
|
21
23
|
type: :runtime
|
22
24
|
prerelease: false
|
23
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
24
27
|
requirements:
|
25
28
|
- - ~>
|
26
29
|
- !ruby/object:Gem::Version
|
@@ -28,113 +31,81 @@ dependencies:
|
|
28
31
|
- !ruby/object:Gem::Dependency
|
29
32
|
name: parslet
|
30
33
|
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
31
35
|
requirements:
|
32
|
-
- - '>='
|
36
|
+
- - ! '>='
|
33
37
|
- !ruby/object:Gem::Version
|
34
38
|
version: '0'
|
35
39
|
type: :runtime
|
36
40
|
prerelease: false
|
37
41
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
38
43
|
requirements:
|
39
|
-
- - '>='
|
44
|
+
- - ! '>='
|
40
45
|
- !ruby/object:Gem::Version
|
41
46
|
version: '0'
|
42
47
|
- !ruby/object:Gem::Dependency
|
43
48
|
name: rails
|
44
49
|
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
45
51
|
requirements:
|
46
|
-
- - '>='
|
52
|
+
- - ! '>='
|
47
53
|
- !ruby/object:Gem::Version
|
48
54
|
version: '0'
|
49
55
|
type: :development
|
50
56
|
prerelease: false
|
51
57
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
52
59
|
requirements:
|
53
|
-
- - '>='
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: '0'
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: combustion
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
59
|
-
requirements:
|
60
|
-
- - '>='
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '0'
|
63
|
-
type: :development
|
64
|
-
prerelease: false
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - '>='
|
60
|
+
- - ! '>='
|
68
61
|
- !ruby/object:Gem::Version
|
69
62
|
version: '0'
|
70
63
|
- !ruby/object:Gem::Dependency
|
71
64
|
name: rspec-rails
|
72
65
|
requirement: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
73
67
|
requirements:
|
74
|
-
- - '>='
|
68
|
+
- - ! '>='
|
75
69
|
- !ruby/object:Gem::Version
|
76
70
|
version: '0'
|
77
71
|
type: :development
|
78
72
|
prerelease: false
|
79
73
|
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
80
75
|
requirements:
|
81
|
-
- - '>='
|
76
|
+
- - ! '>='
|
82
77
|
- !ruby/object:Gem::Version
|
83
78
|
version: '0'
|
84
79
|
- !ruby/object:Gem::Dependency
|
85
|
-
name:
|
86
|
-
requirement: !ruby/object:Gem::Requirement
|
87
|
-
requirements:
|
88
|
-
- - '>='
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version: '0'
|
91
|
-
type: :development
|
92
|
-
prerelease: false
|
93
|
-
version_requirements: !ruby/object:Gem::Requirement
|
94
|
-
requirements:
|
95
|
-
- - '>='
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
version: '0'
|
98
|
-
- !ruby/object:Gem::Dependency
|
99
|
-
name: sqlite3
|
100
|
-
requirement: !ruby/object:Gem::Requirement
|
101
|
-
requirements:
|
102
|
-
- - '>='
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
version: '0'
|
105
|
-
type: :development
|
106
|
-
prerelease: false
|
107
|
-
version_requirements: !ruby/object:Gem::Requirement
|
108
|
-
requirements:
|
109
|
-
- - '>='
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version: '0'
|
112
|
-
- !ruby/object:Gem::Dependency
|
113
|
-
name: launchy
|
80
|
+
name: jettywrapper
|
114
81
|
requirement: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
115
83
|
requirements:
|
116
|
-
- - '>='
|
84
|
+
- - ! '>='
|
117
85
|
- !ruby/object:Gem::Version
|
118
|
-
version:
|
86
|
+
version: 1.4.2
|
119
87
|
type: :development
|
120
88
|
prerelease: false
|
121
89
|
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
122
91
|
requirements:
|
123
|
-
- - '>='
|
92
|
+
- - ! '>='
|
124
93
|
- !ruby/object:Gem::Version
|
125
|
-
version:
|
94
|
+
version: 1.4.2
|
126
95
|
- !ruby/object:Gem::Dependency
|
127
|
-
name:
|
96
|
+
name: engine_cart
|
128
97
|
requirement: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
129
99
|
requirements:
|
130
|
-
- - '>='
|
100
|
+
- - ! '>='
|
131
101
|
- !ruby/object:Gem::Version
|
132
102
|
version: '0'
|
133
103
|
type: :development
|
134
104
|
prerelease: false
|
135
105
|
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
136
107
|
requirements:
|
137
|
-
- - '>='
|
108
|
+
- - ! '>='
|
138
109
|
- !ruby/object:Gem::Version
|
139
110
|
version: '0'
|
140
111
|
description:
|
@@ -145,6 +116,7 @@ extensions: []
|
|
145
116
|
extra_rdoc_files: []
|
146
117
|
files:
|
147
118
|
- .gitignore
|
119
|
+
- .travis.yml
|
148
120
|
- Gemfile
|
149
121
|
- LICENSE
|
150
122
|
- README.rdoc
|
@@ -167,8 +139,8 @@ files:
|
|
167
139
|
- app/views/advanced/index.html.erb
|
168
140
|
- app/views/blacklight_advanced_search/_facet_limit.html.erb
|
169
141
|
- blacklight_advanced_search.gemspec
|
142
|
+
- config/jetty.yml
|
170
143
|
- config/routes.rb
|
171
|
-
- install.rb
|
172
144
|
- lib/blacklight_advanced_search.rb
|
173
145
|
- lib/blacklight_advanced_search/advanced_query_parser.rb
|
174
146
|
- lib/blacklight_advanced_search/catalog_helper_override.rb
|
@@ -181,22 +153,12 @@ files:
|
|
181
153
|
- lib/blacklight_advanced_search/version.rb
|
182
154
|
- lib/generators/blacklight_advanced_search/assets_generator.rb
|
183
155
|
- lib/generators/blacklight_advanced_search/blacklight_advanced_search_generator.rb
|
184
|
-
- lib/generators/blacklight_advanced_search/templates/_search_form.html.erb
|
185
156
|
- lib/generators/blacklight_advanced_search/templates/advanced_controller.rb
|
186
157
|
- lib/parsing_nesting/Readme.rdoc
|
187
158
|
- lib/parsing_nesting/grammar.rb
|
188
159
|
- lib/parsing_nesting/tree.rb
|
189
|
-
- spec/
|
160
|
+
- spec/features/blacklight_advanced_search_form_spec.rb
|
190
161
|
- spec/integration/blacklight_stub_spec.rb
|
191
|
-
- spec/internal/app/controllers/application_controller.rb
|
192
|
-
- spec/internal/app/models/solr_document.rb
|
193
|
-
- spec/internal/config/database.yml
|
194
|
-
- spec/internal/config/routes.rb
|
195
|
-
- spec/internal/config/solr.yml
|
196
|
-
- spec/internal/db/combustion_test.sqlite
|
197
|
-
- spec/internal/db/schema.rb
|
198
|
-
- spec/internal/log/.gitignore
|
199
|
-
- spec/internal/public/favicon.ico
|
200
162
|
- spec/lib/filter_parser_spec.rb
|
201
163
|
- spec/parsing_nesting/build_tree_spec.rb
|
202
164
|
- spec/parsing_nesting/consuming_spec.rb
|
@@ -204,42 +166,43 @@ files:
|
|
204
166
|
- spec/rcov.opts
|
205
167
|
- spec/spec.opts
|
206
168
|
- spec/spec_helper.rb
|
207
|
-
-
|
169
|
+
- spec/test_app_templates/Gemfile.extra
|
170
|
+
- spec/test_app_templates/app/controllers/catalog_controller.rb
|
171
|
+
- spec/test_app_templates/lib/generators/test_app_generator.rb
|
172
|
+
- spec/test_app_templates/lib/tasks/blacklight_test_app.rake
|
208
173
|
homepage: http://projectblacklight.org/
|
209
174
|
licenses: []
|
210
|
-
metadata: {}
|
211
175
|
post_install_message:
|
212
176
|
rdoc_options: []
|
213
177
|
require_paths:
|
214
178
|
- lib
|
215
179
|
required_ruby_version: !ruby/object:Gem::Requirement
|
180
|
+
none: false
|
216
181
|
requirements:
|
217
|
-
- - '>='
|
182
|
+
- - ! '>='
|
218
183
|
- !ruby/object:Gem::Version
|
219
184
|
version: '0'
|
185
|
+
segments:
|
186
|
+
- 0
|
187
|
+
hash: 4211602717521532640
|
220
188
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
189
|
+
none: false
|
221
190
|
requirements:
|
222
|
-
- - '>='
|
191
|
+
- - ! '>='
|
223
192
|
- !ruby/object:Gem::Version
|
224
193
|
version: '0'
|
194
|
+
segments:
|
195
|
+
- 0
|
196
|
+
hash: 4211602717521532640
|
225
197
|
requirements: []
|
226
198
|
rubyforge_project: blacklight
|
227
|
-
rubygems_version:
|
199
|
+
rubygems_version: 1.8.23
|
228
200
|
signing_key:
|
229
|
-
specification_version:
|
201
|
+
specification_version: 3
|
230
202
|
summary: Blacklight Advanced Search plugin
|
231
203
|
test_files:
|
232
|
-
- spec/
|
204
|
+
- spec/features/blacklight_advanced_search_form_spec.rb
|
233
205
|
- spec/integration/blacklight_stub_spec.rb
|
234
|
-
- spec/internal/app/controllers/application_controller.rb
|
235
|
-
- spec/internal/app/models/solr_document.rb
|
236
|
-
- spec/internal/config/database.yml
|
237
|
-
- spec/internal/config/routes.rb
|
238
|
-
- spec/internal/config/solr.yml
|
239
|
-
- spec/internal/db/combustion_test.sqlite
|
240
|
-
- spec/internal/db/schema.rb
|
241
|
-
- spec/internal/log/.gitignore
|
242
|
-
- spec/internal/public/favicon.ico
|
243
206
|
- spec/lib/filter_parser_spec.rb
|
244
207
|
- spec/parsing_nesting/build_tree_spec.rb
|
245
208
|
- spec/parsing_nesting/consuming_spec.rb
|
@@ -247,3 +210,7 @@ test_files:
|
|
247
210
|
- spec/rcov.opts
|
248
211
|
- spec/spec.opts
|
249
212
|
- spec/spec_helper.rb
|
213
|
+
- spec/test_app_templates/Gemfile.extra
|
214
|
+
- spec/test_app_templates/app/controllers/catalog_controller.rb
|
215
|
+
- spec/test_app_templates/lib/generators/test_app_generator.rb
|
216
|
+
- spec/test_app_templates/lib/tasks/blacklight_test_app.rake
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 88c89d9dad653f511cc4e2dea1697197d202629f
|
4
|
-
data.tar.gz: 696d97de529662c487dd7222977509f5989cd8b4
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 363640e863a043a78538fa6626ce9e526d4d8e0327dabd41217e7229ed9f85daa98037267bb46cde9e21cb40d86fa8e535b83a9986deae4bbbd14a706ad28db3
|
7
|
-
data.tar.gz: f46ad4a220c5ce81564a96593f938fdf62b3f156d46a04c929e66a999c97737253912d8626f75744e3b3bc685045308eb7708b02a05aced9f165510b34520cd4
|
data/install.rb
DELETED
File without changes
|
@@ -1,23 +0,0 @@
|
|
1
|
-
<%= form_tag search_action_url, :method => :get, :class => 'search-query-form form-inline clearfix' do %>
|
2
|
-
<%= search_as_hidden_fields(:omit_keys => [:q, :search_field, :qt, :page]).html_safe %>
|
3
|
-
|
4
|
-
<% unless search_fields.empty? %>
|
5
|
-
<div class="pull-left">
|
6
|
-
<label for="search_field" class="hide-text"><%= t('blacklight.search.form.search_field.label') %></label>
|
7
|
-
<%= select_tag(:search_field, options_for_select(search_fields, h(params[:search_field])), :title => t('blacklight.search.form.search_field.title'), :class=>"search_field input-small") %>
|
8
|
-
<span class="hide-text"><%= t('blacklight.search.form.search_field.post_label') %></span>
|
9
|
-
</div>
|
10
|
-
<% end %>
|
11
|
-
<div class="input-append pull-left">
|
12
|
-
<label for="q" class="hide-text"><%= t('blacklight.search.form.q') %></label>
|
13
|
-
<%= text_field_tag :q, params[:q], :placeholder => t('blacklight.search.form.q'), :class => "search_q q", :id => "q"%>
|
14
|
-
<button type="submit" class="btn btn-primary search-btn" id="search">
|
15
|
-
<span class="submit-search-text"><%=t('blacklight.search.form.submit')%></span>
|
16
|
-
<i class="icon-search icon-white"></i>
|
17
|
-
</button>
|
18
|
-
|
19
|
-
</div>
|
20
|
-
|
21
|
-
<% end %>
|
22
|
-
|
23
|
-
<%= link_to 'More options', params.merge(:controller=>"advanced", :action=>"index") , :class=>"advanced_search"%>
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# = jetty_path key
|
2
|
-
# each environment can have a jetty_path with absolute or relative
|
3
|
-
# (to app root) path to a jetty/solr install. This is used
|
4
|
-
# by the rake tasks that start up solr automatically for testing
|
5
|
-
# and by rake solr:marc:index.
|
6
|
-
#
|
7
|
-
# jetty_path is not used by a running Blacklight application
|
8
|
-
# at all. In general you do NOT need to deploy solr in Jetty, you can deploy it
|
9
|
-
# however you want.
|
10
|
-
# jetty_path is only required for rake tasks that need to know
|
11
|
-
# how to start up solr, generally for automated testing.
|
12
|
-
|
13
|
-
development:
|
14
|
-
url: http://127.0.0.1:8983/solr
|
15
|
-
test: &test
|
16
|
-
url: http://127.0.0.1:8888/solr
|
17
|
-
cucumber:
|
18
|
-
<<: *test
|
Binary file
|
data/spec/internal/db/schema.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
# This file is auto-generated from the current state of the database. Instead
|
3
|
-
# of editing this file, please use the migrations feature of Active Record to
|
4
|
-
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
-
#
|
6
|
-
# Note that this schema.rb definition is the authoritative source for your
|
7
|
-
# database schema. If you need to create the application database on another
|
8
|
-
# system, you should be using db:schema:load, not running all the migrations
|
9
|
-
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
-
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
-
#
|
12
|
-
# It's strongly recommended to check this file into your version control system.
|
13
|
-
|
14
|
-
ActiveRecord::Schema.define(:version => 20111123152341) do
|
15
|
-
|
16
|
-
create_table "bookmarks", :force => true do |t|
|
17
|
-
t.integer "user_id", :null => false
|
18
|
-
t.string "document_id"
|
19
|
-
t.string "title"
|
20
|
-
t.datetime "created_at"
|
21
|
-
t.datetime "updated_at"
|
22
|
-
t.string "user_type"
|
23
|
-
end
|
24
|
-
|
25
|
-
create_table "searches", :force => true do |t|
|
26
|
-
t.text "query_params"
|
27
|
-
t.integer "user_id"
|
28
|
-
t.datetime "created_at"
|
29
|
-
t.datetime "updated_at"
|
30
|
-
t.string "user_type"
|
31
|
-
end
|
32
|
-
|
33
|
-
add_index "searches", ["user_id"], :name => "index_searches_on_user_id"
|
34
|
-
|
35
|
-
create_table "users", :force => true do |t|
|
36
|
-
t.string "email", :default => "", :null => false
|
37
|
-
t.string "encrypted_password", :limit => 128, :default => "", :null => false
|
38
|
-
t.string "reset_password_token"
|
39
|
-
t.datetime "reset_password_sent_at"
|
40
|
-
t.datetime "remember_created_at"
|
41
|
-
t.integer "sign_in_count", :default => 0
|
42
|
-
t.datetime "current_sign_in_at"
|
43
|
-
t.datetime "last_sign_in_at"
|
44
|
-
t.string "current_sign_in_ip"
|
45
|
-
t.string "last_sign_in_ip"
|
46
|
-
t.datetime "created_at"
|
47
|
-
t.datetime "updated_at"
|
48
|
-
end
|
49
|
-
|
50
|
-
add_index "users", ["email"], :name => "index_users_on_email", :unique => true
|
51
|
-
add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
|
52
|
-
|
53
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
*.log
|
File without changes
|
data/uninstall.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# Uninstall hook code here
|