blacklight_advanced_search 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +21 -46
- data/VERSION +1 -1
- data/app/assets/stylesheets/blacklight_advanced_search/{blacklight_advanced_search_styles.css → blacklight_advanced_search_styles.css.scss} +0 -24
- data/app/controllers/advanced_controller.rb +8 -63
- data/app/controllers/blacklight_advanced_search/advanced_controller.rb +58 -0
- data/app/helpers/advanced_helper.rb +2 -2
- data/app/views/advanced/_advanced_search_facets.html.erb +1 -16
- data/app/views/advanced/_advanced_search_fields.html.erb +3 -3
- data/app/views/advanced/_advanced_search_form.html.erb +3 -13
- data/app/views/advanced/_facet_layout.html.erb +5 -0
- data/app/views/advanced/_facet_limit.html.erb +7 -0
- data/app/views/blacklight_advanced_search/_facet_limit.html.erb +1 -15
- data/blacklight_advanced_search.gemspec +1 -1
- data/lib/blacklight_advanced_search.rb +0 -66
- data/lib/blacklight_advanced_search/advanced_query_parser.rb +2 -3
- data/lib/blacklight_advanced_search/catalog_helper_override.rb +4 -8
- data/lib/blacklight_advanced_search/controller.rb +6 -6
- data/lib/blacklight_advanced_search/engine.rb +0 -7
- data/lib/blacklight_advanced_search/parsing_nesting_parser.rb +3 -3
- data/lib/blacklight_advanced_search/render_constraints_override.rb +7 -7
- data/lib/generators/blacklight_advanced_search/assets_generator.rb +40 -45
- data/lib/generators/blacklight_advanced_search/blacklight_advanced_search_generator.rb +2 -4
- data/lib/generators/blacklight_advanced_search/templates/advanced_controller.rb +57 -0
- metadata +49 -74
- data/lib/generators/blacklight_advanced_search/templates/blacklight_advanced_search_config.rb +0 -86
data/README.rdoc
CHANGED
@@ -2,11 +2,11 @@ This is an advanced search plugin for Blacklight ( http://www.projectblacklight.
|
|
2
2
|
|
3
3
|
== Pre-requisites:
|
4
4
|
* The Blacklight plugin ( http://github.com/projectblacklight/blacklight )
|
5
|
-
* NOTE: Blacklight 3.
|
5
|
+
* NOTE: Blacklight 3.2 is required for current version of Advanced Search plugin
|
6
|
+
* 1.1.x versions will work with older version of Blacklight 3.x
|
6
7
|
* advanced search plugin latest 0.X.X version will work with Blacklight 2.9/Rails2.
|
7
8
|
* Older tagged versions of Advanced Search may work with even older BL.
|
8
9
|
|
9
|
-
|
10
10
|
== Installation:
|
11
11
|
|
12
12
|
=== Blacklight 3.x/Rails 3
|
@@ -17,34 +17,12 @@ Add to your application's Gemfile:
|
|
17
17
|
then run 'bundle install'. Then run:
|
18
18
|
rails generate blacklight_advanced_search
|
19
19
|
|
20
|
-
* The 'generate' command will
|
21
|
-
* It will also
|
20
|
+
* The 'generate' command will install the plugin's assets into your application's application.js/application.css asset pipeline files
|
21
|
+
* It will also generate AdvancedController into app/controllers/advanced_controller.rb, which you should configure for your local needs.
|
22
22
|
* And it can optionally install a localized search form with a link to advanced search. If you've already localized your search form you'll want to do this manually instead.
|
23
23
|
|
24
|
-
You may want to set
|
25
|
-
|
26
|
-
=== Blacklight 2.x/Rails2
|
27
|
-
|
28
|
-
Clone the advanced search plugin from github into your application's vendor/plugins directory , and switch
|
29
|
-
to a version that works with BL 2.x/Rails2.
|
30
|
-
* cd into your application's vendor/plugins directory and run the following command:
|
31
|
-
git clone http://github.com/projectblacklight/blacklight_advanced_search.git
|
32
|
-
git checkout v0.12.0
|
24
|
+
You may want to set `blacklight_config.advanced_search.advanced_parse_q = true` to enable AND/OR/NOT parsing even in ordinary search, this is not on by default.
|
33
25
|
|
34
|
-
You can later use standard git commands to update the plugin to a new version.
|
35
|
-
|
36
|
-
You will now need to add a parslet gem dependency to your app, since blacklight_advanced_search is not currently a gem itself, you have to do this manually. Add "config.gem 'parslet'" to your config/environment.rb, and then run:
|
37
|
-
|
38
|
-
sudo rake gems:install
|
39
|
-
|
40
|
-
You can also now *optionally* run the installer script to install some optional example configuration files. In many cases, no configuration is needed for advanced search plugin to work.
|
41
|
-
* cd back to your application's root directory
|
42
|
-
cd ../../
|
43
|
-
* And then run the the following command:
|
44
|
-
rake rails:template LOCATION=vendor/plugins/blacklight_advanced_search/template.rb
|
45
|
-
|
46
|
-
You may want to set BlacklightAdvancedSearch.config[:advanced_parse_q] = true to enable AND/OR/NOT parsing even in ordinary search, this is not on by default.
|
47
|
-
|
48
26
|
== Accessing
|
49
27
|
|
50
28
|
|
@@ -76,7 +54,7 @@ The optional installer script can install a sample blacklight_advanced_search.rb
|
|
76
54
|
|
77
55
|
=== Expression parsing in ordinary search
|
78
56
|
|
79
|
-
If you turn on this feature with `
|
57
|
+
If you turn on this feature with `blacklight_config.advanced_search.advanced_parse_q = true`, then the plugin will intercept queries entered in ordinary Blacklight search interface, and parse them for AND/OR/NOT (and parens), producing appropriate Solr query. This allows single-field boolean expressions to be entered in ordinary search, providing a consistent experience with advanced search.
|
80
58
|
|
81
59
|
When this feature is turned on, queries that don't have any special operators (eg: AND, OR, NOT, parens) will still be passed to Solr much the same as they were before. But queries with special operators will have appropriate Solr queries generated for them, usually including nested "_query_" elements, to have the same meaning they would in advanced search. If a user enters something that is a syntax error for parsed search (for instance an unclosed phrase quote or paren), the logic will rescue from the parse erorr by running the exact user entered query direct to solr without advanced parsing.
|
82
60
|
|
@@ -87,29 +65,28 @@ Due to limitations of the logic, sometimes these generated Solr queries may not
|
|
87
65
|
Your main blacklight search fields are generally defined in config/blacklight_config.rb, under "config[:search_fields]" ( https://github.com/projectblacklight/blacklight/blob/master/config/initializers/blacklight_config.rb#L194 ). If there are particular search fields in your main blacklight config you want excluded from the advanced search form, you can set ":include_in_advanced_search => false"
|
88
66
|
|
89
67
|
All advanced search fields must share the same Solr request handler (":qt"). As such, search fields that use a custom ":qt" parameter may not be re-used by the advanced search plugin. However, you may use a separate Solr request handler than the Blacklight default. If you would like the advanced search to use a different Solr request handler than your app's default, set:
|
90
|
-
|
68
|
+
blacklight_config.advanced_search.qt
|
91
69
|
to the name of the Solr request handler.
|
92
70
|
|
93
71
|
If you use a separate Solr request handler for advanced search, you must supply a completely separate list of search fields for the advanced search form. Each field is defined by a hash whose format is specified in Blacklight::SearchFields ( https://github.com/projectblacklight/blacklight/blob/master/lib/blacklight/search_fields.rb#L7 ).
|
94
72
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
73
|
+
blacklight_config.search_fields.empty
|
74
|
+
|
75
|
+
blacklight_config.add_search_field('title') do |field|
|
76
|
+
field.solr_local_parameters => {
|
99
77
|
:qf => "title_t subtitle_t addl_titles_t title_unstem_search^1000" # see ( http://wiki.apache.org/solr/DisMaxQParserPlugin#qf_.28Query_Fields.29 )
|
100
78
|
:pf => "title_t subtitle_t addl_titles_t title_unstem_search^1000" # see ( http://wiki.apache.org/solr/DisMaxQParserPlugin#pf_.28Phrase_Fields.29 )
|
101
79
|
}
|
102
|
-
|
80
|
+
end
|
103
81
|
|
104
82
|
Additionally, to make your advanced search solr requests more concise, you are strongly encouraged to take advantage of the :local_solr_parameters option in your search field definition to use a solr parameter substitution with $variables.
|
105
83
|
|
106
|
-
|
107
|
-
|
108
|
-
:solr_local_parameters => {
|
84
|
+
blacklight_config.add_search_field('authot') do |field|
|
85
|
+
field.solr_local_parameters => {
|
109
86
|
:qf=>"$qf_author",
|
110
87
|
:pf=>"$pf_author"
|
111
88
|
}
|
112
|
-
|
89
|
+
end
|
113
90
|
|
114
91
|
Within your solrconfig.xml you may then provide the appropriate custom configuration.
|
115
92
|
|
@@ -140,24 +117,22 @@ Within your solrconfig.xml you may then provide the appropriate custom configura
|
|
140
117
|
|
141
118
|
By default, the advanced search form will show as limits whatever facets are configured as default in your Solr request handler. To have the advanced search form request specific facets and/or specific facet parameters, you can set config[:form_solr_parameters].
|
142
119
|
|
143
|
-
|
120
|
+
blacklight_config.advanced_search.form_solr_parameters = {
|
144
121
|
"facet.field" => ["format", "language_facet"],
|
145
122
|
"facet.limit" => -1, # return all facet values
|
146
123
|
"facet.sort" => "index" # sort by byte order of values
|
147
124
|
}
|
148
125
|
|
149
126
|
|
150
|
-
===
|
127
|
+
=== Advanced Search Config Options
|
151
128
|
|
152
|
-
[
|
129
|
+
[:qt]
|
153
130
|
Solr request handler to use for any search that includes advanced search criteria. Defaults to what the application has set as Blacklight.config[:default_qt]
|
154
|
-
[
|
131
|
+
[:url_key]
|
155
132
|
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]".
|
156
|
-
[
|
157
|
-
Array of search field definitions to be used for advanced search. Each element in the array is a hash of the form required by Blacklight::SearchFields. If left blank, the plugin will use definitions from your main app Blacklight.config[:search_fields] -- only those which have no :qt set, and do not have :include_in_advanced_search => false.
|
158
|
-
[config[:form_solr_paramters]]
|
133
|
+
[:form_solr_paramters]
|
159
134
|
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.
|
160
|
-
[
|
135
|
+
[:advanced_parse_q]
|
161
136
|
Set to 'true' to have AND/OR/NOT parsed even in ordinary 'simple' blacklight search, and converted to appropriate Solr query for that single field.
|
162
137
|
|
163
138
|
== Translation to Solr Query, technical details
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.2.0
|
@@ -1,28 +1,4 @@
|
|
1
1
|
|
2
|
-
/* Kind of wacky stuff to make scrolling on limit column work right. */
|
3
|
-
|
4
|
-
.input_columns {
|
5
|
-
position: relative;
|
6
|
-
}
|
7
|
-
|
8
|
-
.limit_column {
|
9
|
-
position: absolute;
|
10
|
-
top: 0;
|
11
|
-
bottom: 0;
|
12
|
-
right: 0;
|
13
|
-
width: 49.1%;
|
14
|
-
overflow-y: hidden;
|
15
|
-
}
|
16
|
-
|
17
|
-
.limit_input {
|
18
|
-
position: absolute;
|
19
|
-
top: 6em;
|
20
|
-
bottom: 0;
|
21
|
-
right: 0;
|
22
|
-
left: 0;
|
23
|
-
overflow-y: auto;
|
24
|
-
}
|
25
|
-
|
26
2
|
/* Random styles */
|
27
3
|
|
28
4
|
.advanced_search_field label {
|
@@ -1,63 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
unless request.method==:post
|
10
|
-
@response = get_advanced_search_facets
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
protected
|
15
|
-
def get_advanced_search_facets
|
16
|
-
|
17
|
-
search_context_params = {}
|
18
|
-
if (advanced_search_context.length > 0 )
|
19
|
-
# We have a search context, need to fetch facets from within
|
20
|
-
# that context -- but we dont' want to search within any
|
21
|
-
# existing :q or ADVANCED facets, so we remove those params.
|
22
|
-
adv_keys = BlacklightAdvancedSearch.config[:search_fields].collect {|d| d[:key].to_sym}
|
23
|
-
trimmed_params = params.reject do |k,v|
|
24
|
-
adv_keys.include?(k.to_sym) # the individual q params
|
25
|
-
end
|
26
|
-
trimmed_params.delete(:f_inclusive) # adv facets
|
27
|
-
|
28
|
-
search_context_params = solr_search_params(trimmed_params)
|
29
|
-
# Don't want to include the 'q' from basic search in our search
|
30
|
-
# context. Kind of hacky becuase solr_search_params insists on
|
31
|
-
# using controller.params, not letting us over-ride.
|
32
|
-
search_context_params.delete(:q)
|
33
|
-
search_context_params.delete("q")
|
34
|
-
|
35
|
-
# Also delete any facet-related params, or anything else
|
36
|
-
# we want to set ourselves or inherit from Solr request handler
|
37
|
-
# defaults.
|
38
|
-
search_context_params.delete_if do |k, v|
|
39
|
-
k = k.to_s
|
40
|
-
(["facet.limit", "facet.sort", "f", "facets", "facet.fields", "qt", "per_page"].include?(k) ||
|
41
|
-
k =~ /f\..+\.facet\.limit/ ||
|
42
|
-
k =~ /f\..+\.facet\.sort/
|
43
|
-
)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
input = HashWithIndifferentAccess.new
|
48
|
-
input.merge!( search_context_params )
|
49
|
-
input.merge!( :qt => BlacklightAdvancedSearch.config[:qt] , :per_page => 0)
|
50
|
-
input.merge!( BlacklightAdvancedSearch.config[:form_solr_parameters] )
|
51
|
-
input[:q] ||= '{!lucene}*:*'
|
52
|
-
|
53
|
-
|
54
|
-
find(input.to_hash)
|
55
|
-
end
|
56
|
-
def setup_advanced_search_assets
|
57
|
-
unless BlacklightAdvancedSearch.use_asset_pipeline?
|
58
|
-
stylesheet_links << ["blacklight_advanced_search_styles", {:plugin=>:blacklight_advanced_search}]
|
59
|
-
javascript_includes << ["blacklight_advanced_search_javascript", {:plugin=>:blacklight_advanced_search}]
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
end
|
1
|
+
class AdvancedController < BlacklightAdvancedSearch::AdvancedController
|
2
|
+
|
3
|
+
blacklight_config.configure do |config|
|
4
|
+
config.advanced_search.form_solr_parameters ||= {}
|
5
|
+
config.advanced_search.url_key ||= 'advanced'
|
6
|
+
end
|
7
|
+
|
8
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# Need to sub-class CatalogController so we get all other plugins behavior
|
2
|
+
# for our own "inside a search context" lookup of facets.
|
3
|
+
class BlacklightAdvancedSearch::AdvancedController < CatalogController
|
4
|
+
include AdvancedHelper # so we get the #advanced_search_context method
|
5
|
+
|
6
|
+
blacklight_config.configure do |config|
|
7
|
+
config.advanced_search ||= Blacklight::OpenStructWithHashAccess.new
|
8
|
+
end
|
9
|
+
|
10
|
+
def index
|
11
|
+
unless request.method==:post
|
12
|
+
@response = get_advanced_search_facets
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
protected
|
17
|
+
def get_advanced_search_facets
|
18
|
+
|
19
|
+
search_context_params = {}
|
20
|
+
if (advanced_search_context.length > 0 )
|
21
|
+
# We have a search context, need to fetch facets from within
|
22
|
+
# that context -- but we dont' want to search within any
|
23
|
+
# existing :q or ADVANCED facets, so we remove those params.
|
24
|
+
adv_keys = blacklight_config.search_fields.keys.map {|k| k.to_sym}
|
25
|
+
trimmed_params = params.reject do |k,v|
|
26
|
+
adv_keys.include?(k.to_sym) # the individual q params
|
27
|
+
end
|
28
|
+
trimmed_params.delete(:f_inclusive) # adv facets
|
29
|
+
|
30
|
+
search_context_params = solr_search_params(trimmed_params)
|
31
|
+
# Don't want to include the 'q' from basic search in our search
|
32
|
+
# context. Kind of hacky becuase solr_search_params insists on
|
33
|
+
# using controller.params, not letting us over-ride.
|
34
|
+
search_context_params.delete(:q)
|
35
|
+
search_context_params.delete("q")
|
36
|
+
|
37
|
+
# Also delete any facet-related params, or anything else
|
38
|
+
# we want to set ourselves or inherit from Solr request handler
|
39
|
+
# defaults.
|
40
|
+
search_context_params.delete_if do |k, v|
|
41
|
+
k = k.to_s
|
42
|
+
(["facet.limit", "facet.sort", "f", "facets", "facet.fields", "qt", "per_page"].include?(k) ||
|
43
|
+
k =~ /f\..+\.facet\.limit/ ||
|
44
|
+
k =~ /f\..+\.facet\.sort/
|
45
|
+
)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
input = HashWithIndifferentAccess.new
|
50
|
+
input.merge!( search_context_params )
|
51
|
+
input.merge!( :qt => blacklight_config.advanced_search[:qt] , :per_page => 0)
|
52
|
+
input.merge!( blacklight_config.advanced_search[:form_solr_parameters] )
|
53
|
+
input[:q] ||= '{!lucene}*:*'
|
54
|
+
|
55
|
+
|
56
|
+
find(input.to_hash)
|
57
|
+
end
|
58
|
+
end
|
@@ -27,14 +27,14 @@ module AdvancedHelper
|
|
27
27
|
[:page, :commit, :f_inclusive, :q, :search_field, :op, :action, :index, :sort, :controller].each do |bad_key|
|
28
28
|
my_params.delete(bad_key)
|
29
29
|
end
|
30
|
-
search_fields_for_advanced_search.each do |field_def|
|
30
|
+
search_fields_for_advanced_search.each do |key, field_def|
|
31
31
|
my_params.delete( field_def[:key] )
|
32
32
|
end
|
33
33
|
my_params
|
34
34
|
end
|
35
35
|
|
36
36
|
def search_fields_for_advanced_search
|
37
|
-
|
37
|
+
blacklight_config.search_fields
|
38
38
|
end
|
39
39
|
|
40
40
|
end
|
@@ -1,16 +1 @@
|
|
1
|
-
|
2
|
-
<div class="facet_item">
|
3
|
-
<% display_facet = @response.facets.detect {|f| f.name == solr_fname} -%>
|
4
|
-
<% # if it's NOT a refinement facet -- they are handled in get_refine_facet -%>
|
5
|
-
<% if display_facet && display_facet.items.length > 0 %>
|
6
|
-
<h3><%= facet_field_labels[solr_fname] -%> <span class="adv_facet_selections" style="display:none;"></span></h3>
|
7
|
-
<ul>
|
8
|
-
<% display_facet.items.each do |item| -%>
|
9
|
-
<li>
|
10
|
-
<%= check_box_tag "f_inclusive[#{solr_fname}][#{item.value.to_sym}]", 1, facet_value_checked?(solr_fname, item.value)%> <%= label_tag "f_inclusive_#{solr_fname}[#{item.value.to_sym}]", h(item.value) %> (<%= format_num item.hits %>)
|
11
|
-
</li>
|
12
|
-
<% end -%>
|
13
|
-
</ul>
|
14
|
-
<% end %>
|
15
|
-
</div>
|
16
|
-
<% end %>
|
1
|
+
<%= render_facet_partials facet_field_names, :partial => 'facet_limit' %>
|
@@ -1,6 +1,6 @@
|
|
1
|
-
<%-
|
1
|
+
<%- blacklight_config.search_fields.each do |key, field_def| -%>
|
2
2
|
<div class="advanced_search_field">
|
3
|
-
<%= label_tag
|
4
|
-
<%= text_field_tag
|
3
|
+
<%= label_tag key, "#{field_def.label }:" %>
|
4
|
+
<%= text_field_tag key, label_tag_default_for(key) %>
|
5
5
|
</div>
|
6
6
|
<%- end -%>
|
@@ -4,8 +4,6 @@
|
|
4
4
|
|
5
5
|
<div class="input_columns yui-g">
|
6
6
|
|
7
|
-
<div class="yui-u first">
|
8
|
-
|
9
7
|
<div class="query_column column">
|
10
8
|
<h2>Find items that match <%= select_tag(:op, options_for_select({'all'=>'AND','any'=>'OR'}.sort,'all')) %> of the fields below:</h2>
|
11
9
|
|
@@ -13,21 +11,13 @@
|
|
13
11
|
<%= render 'advanced/advanced_search_fields' %>
|
14
12
|
</div>
|
15
13
|
</div>
|
16
|
-
|
17
|
-
</div>
|
18
|
-
|
19
|
-
<div class="yui-u">
|
20
|
-
|
21
|
-
<div class="limit_column column">
|
14
|
+
<div class="limit_column column">
|
22
15
|
<h2><strong>AND</strong> have these attributes:</h2>
|
23
16
|
|
24
17
|
<div id="advanced_search_facets" class="limit_input">
|
25
18
|
<%= render 'advanced_search_facets' %>
|
26
19
|
</div>
|
27
20
|
</div>
|
28
|
-
|
29
|
-
</div>
|
30
|
-
|
31
21
|
</div>
|
32
22
|
|
33
23
|
<% unless (search_context_str = render_search_to_s( advanced_search_context)).blank? %>
|
@@ -40,8 +30,8 @@
|
|
40
30
|
|
41
31
|
<div class="sort_submit_buttons">
|
42
32
|
<%= label_tag(:sort, "Sort results by") %>
|
43
|
-
<%= select_tag(:sort, options_for_select(
|
44
|
-
<%= hidden_field_tag(:search_field,
|
33
|
+
<%= select_tag(:sort, options_for_select(sort_fields, h(params[:sort]))) %>
|
34
|
+
<%= hidden_field_tag(:search_field, blacklight_config.advanced_search[:url_key]) %>
|
45
35
|
<%= submit_tag 'Search', :class=>'advanced_button', :id=>'advanced_search' %>
|
46
36
|
<%= link_to "Start over", {:controller => "advanced", :action => "index"}, :class =>"reset advanced_button" %>
|
47
37
|
</div>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<ul>
|
2
|
+
<% display_facet.items.each do |item| -%>
|
3
|
+
<li>
|
4
|
+
<%= check_box_tag "f_inclusive[#{solr_field}][#{item.value.to_sym}]", 1, facet_value_checked?(solr_field, item.value)%> <%= label_tag "f_inclusive_#{solr_field}[#{item.value.to_sym}]", h(item.value) %> (<%= format_num item.hits %>)
|
5
|
+
</li>
|
6
|
+
<% end -%>
|
7
|
+
</ul>
|
@@ -1,15 +1,3 @@
|
|
1
|
-
<%-
|
2
|
-
# Custom facet_limit partial that displays inclusive 'or' advanced facet
|
3
|
-
# limits at the top, then lets you drill down into ordinary facets.
|
4
|
-
#
|
5
|
-
# pass in :solr_field local.
|
6
|
-
#
|
7
|
-
# Assumes an @advanced_query exists, and probably has #filters for this
|
8
|
-
# solr_field.
|
9
|
-
-%>
|
10
|
-
|
11
|
-
<h3><%= facet_field_labels[solr_field] -%></h3>
|
12
|
-
|
13
1
|
<div class="advanced_facet_limit">
|
14
2
|
<div class="inclusive_or">
|
15
3
|
<h4>Any of:</h4>
|
@@ -20,6 +8,4 @@
|
|
20
8
|
</ul>
|
21
9
|
</div>
|
22
10
|
|
23
|
-
<%=
|
24
|
-
|
25
|
-
</div>
|
11
|
+
<%= render_facet_limit display_facet, :layout => nil, :partial => 'catalog/facet_limit' %>
|
@@ -9,70 +9,4 @@ module BlacklightAdvancedSearch
|
|
9
9
|
require 'blacklight_advanced_search/version'
|
10
10
|
require 'blacklight_advanced_search/engine'
|
11
11
|
|
12
|
-
extend Blacklight::SearchFields # for search field config, so we can use same format as BL, or use ones already set in BL even.
|
13
|
-
|
14
|
-
# Has to be called in an after_initialize block, to have access
|
15
|
-
# to Blacklight.config already configured, to look at it for defaults.
|
16
|
-
def self.init
|
17
|
-
# apply defaults to anything not set.
|
18
|
-
BlacklightAdvancedSearch.config.reverse_merge!( BlacklightAdvancedSearch.config_defaults )
|
19
|
-
|
20
|
-
logger.info("BlacklightAdvancedSearch.config: initialized with: #{ config.inspect }")
|
21
|
-
Blacklight.config[:search_fields] << {:display_label => 'Advanced', :key => BlacklightAdvancedSearch.config[:url_key], :include_in_simple_select => false, :include_in_advanced_search => false} unless Blacklight.config[:search_fields].map { |x| x[:key] }.include? BlacklightAdvancedSearch.config[:url_key]
|
22
|
-
end
|
23
|
-
|
24
|
-
def self.logger
|
25
|
-
Rails.logger
|
26
|
-
end
|
27
|
-
|
28
|
-
# Hash of our config. The :search_fields key in hash is used by
|
29
|
-
# Blacklight::SearchFields module, must be an array of search field
|
30
|
-
# definitions compatible with that module, or if missing will
|
31
|
-
# inherit Blacklight.config[:search_fields]
|
32
|
-
def self.config
|
33
|
-
@config ||= {}
|
34
|
-
end
|
35
|
-
|
36
|
-
# Has to be called in an after_initialize, to make sure Blacklight.config
|
37
|
-
# is already defined.
|
38
|
-
def self.config_defaults
|
39
|
-
config = {}
|
40
|
-
config[:url_key] ||= "advanced"
|
41
|
-
config[:qt] ||= Blacklight.config[:default_qt] ||
|
42
|
-
(Blacklight.config[:default_solr_params] && Blacklight.config[:default_solr_params][:qt])
|
43
|
-
config[:form_solr_parameters] ||= {}
|
44
|
-
|
45
|
-
|
46
|
-
config[:search_fields] ||= Blacklight.config[:search_fields].find_all do |field_def|
|
47
|
-
(field_def[:qt].nil? || field_def[:qt] == config[:qt]) &&
|
48
|
-
field_def[:include_in_advanced_search] != false
|
49
|
-
end
|
50
|
-
|
51
|
-
config
|
52
|
-
end
|
53
|
-
|
54
|
-
|
55
|
-
def self.solr_local_params_for_search_field(key)
|
56
|
-
|
57
|
-
field_def = search_field_def_for_key(key)
|
58
|
-
|
59
|
-
solr_params = (field_def[:solr_parameters] || {}).merge(field_def[:solr_local_parameters] || {})
|
60
|
-
|
61
|
-
solr_params.collect do |key, val|
|
62
|
-
key.to_s + "=" + solr_param_quote(val)
|
63
|
-
end.join(" ")
|
64
|
-
|
65
|
-
end
|
66
|
-
|
67
|
-
def self.solr_param_quote(val)
|
68
|
-
unless val =~ /^[a-zA-Z$_\-\^]+$/
|
69
|
-
val = "'" + val.gsub("'", "\\\'").gsub('"', "\\\"") + "'"
|
70
|
-
end
|
71
|
-
return val
|
72
|
-
end
|
73
|
-
|
74
|
-
def self.use_asset_pipeline?
|
75
|
-
(Rails::VERSION::MAJOR >= 3 and Rails::VERSION::MINOR >= 1) and Rails.application.config.assets.enabled
|
76
|
-
end
|
77
|
-
|
78
12
|
end
|
@@ -27,10 +27,9 @@ module BlacklightAdvancedSearch
|
|
27
27
|
unless(@keyword_queries)
|
28
28
|
@keyword_queries = {}
|
29
29
|
|
30
|
-
return @keyword_queries unless @params[:search_field] ==
|
30
|
+
return @keyword_queries unless @params[:search_field] == ::AdvancedController.blacklight_config.advanced_search[:url_key]
|
31
31
|
|
32
|
-
|
33
|
-
key = field_def[:key]
|
32
|
+
config.search_fields.each do | key, field_def |
|
34
33
|
if ! @params[ key.to_sym ].blank?
|
35
34
|
@keyword_queries[ key ] = @params[ key.to_sym ]
|
36
35
|
end
|
@@ -19,13 +19,9 @@ module BlacklightAdvancedSearch::CatalogHelperOverride
|
|
19
19
|
|
20
20
|
# Special display for facet limits that include adv search inclusive
|
21
21
|
# or limits.
|
22
|
-
def
|
23
|
-
|
24
|
-
|
25
|
-
else
|
26
|
-
# our own display
|
27
|
-
render(:partial => "blacklight_advanced_search/facet_limit", :locals=> {:solr_field => solr_field})
|
28
|
-
end
|
22
|
+
def facet_partial_name(display_facet = nil)
|
23
|
+
return "blacklight_advanced_search/facet_limit" if @advanced_query && @advanced_query.filters.keys.include?( display_facet.name )
|
24
|
+
super
|
29
25
|
end
|
30
26
|
|
31
27
|
def remove_advanced_facet_param(field, value, my_params = params)
|
@@ -50,4 +46,4 @@ module BlacklightAdvancedSearch::CatalogHelperOverride
|
|
50
46
|
my_params
|
51
47
|
end
|
52
48
|
|
53
|
-
end
|
49
|
+
end
|
@@ -6,7 +6,7 @@ module BlacklightAdvancedSearch::Controller
|
|
6
6
|
extend ActiveSupport::Concern
|
7
7
|
|
8
8
|
included do
|
9
|
-
if
|
9
|
+
if blacklight_config[:advanced_parse_q]
|
10
10
|
# Only to parse AND/OR in ordinary 'q'
|
11
11
|
solr_search_params_logic << :add_advanced_parse_q_to_solr
|
12
12
|
end
|
@@ -29,15 +29,15 @@ module BlacklightAdvancedSearch::Controller
|
|
29
29
|
# map that to solr #q, over-riding whatever some other logic may have set, yeah.
|
30
30
|
# the hint right now is :search_field request param is set to a magic
|
31
31
|
# key.
|
32
|
-
if (req_params[:search_field] ==
|
32
|
+
if (req_params[:search_field] == ::AdvancedController.blacklight_config.advanced_search[:url_key] ||
|
33
33
|
req_params[:f_inclusive])
|
34
34
|
# Set this as a controller instance variable, not sure if some views/helpers depend on it. Better to leave it as a local variable
|
35
35
|
# if not, more investigation later.
|
36
|
-
@advanced_query = BlacklightAdvancedSearch::QueryParser.new(req_params,
|
36
|
+
@advanced_query = BlacklightAdvancedSearch::QueryParser.new(req_params, ::AdvancedController.blacklight_config )
|
37
37
|
deep_merge!(solr_parameters, @advanced_query.to_solr )
|
38
38
|
if @advanced_query.keyword_queries.length > 0
|
39
39
|
# force :qt if set
|
40
|
-
solr_parameters[:qt] =
|
40
|
+
solr_parameters[:qt] = ::AdvancedController.blacklight_config.advanced_search[:qt]
|
41
41
|
solr_parameters[:defType] = "lucene"
|
42
42
|
end
|
43
43
|
|
@@ -57,8 +57,8 @@ module BlacklightAdvancedSearch::Controller
|
|
57
57
|
# were not being used.
|
58
58
|
def add_advanced_parse_q_to_solr(solr_parameters, req_params = params)
|
59
59
|
unless req_params[:q].blank?
|
60
|
-
field_def =
|
61
|
-
|
60
|
+
field_def = search_field_def_for_key( req_params[:search_field]) ||
|
61
|
+
default_search_field
|
62
62
|
|
63
63
|
|
64
64
|
# If the individual field has advanced_parse_q suppressed, punt
|
@@ -5,13 +5,6 @@ require 'rails'
|
|
5
5
|
module BlacklightAdvancedSearch
|
6
6
|
class Engine < Rails::Engine
|
7
7
|
|
8
|
-
config.after_initialize do
|
9
|
-
# After local app initializers that may set some config, we
|
10
|
-
# finish it off with defaults and normalization.
|
11
|
-
BlacklightAdvancedSearch.init
|
12
|
-
end
|
13
|
-
|
14
|
-
|
15
8
|
# Do these things in a to_prepare block, to try and make them work
|
16
9
|
# in development mode with class-reloading. The trick is we can't
|
17
10
|
# be sure if the controllers we're modifying are being reloaded in
|
@@ -4,13 +4,13 @@ module BlacklightAdvancedSearch::ParsingNestingParser
|
|
4
4
|
def process_query(params,config)
|
5
5
|
queries = []
|
6
6
|
keyword_queries.each do |field,query|
|
7
|
-
queries << ParsingNesting::Tree.parse(query).to_query( local_param_hash(field) )
|
7
|
+
queries << ParsingNesting::Tree.parse(query).to_query( local_param_hash(field, config) )
|
8
8
|
end
|
9
9
|
queries.join( ' ' + keyword_op + ' ')
|
10
10
|
end
|
11
11
|
|
12
|
-
def local_param_hash(key)
|
13
|
-
field_def =
|
12
|
+
def local_param_hash(key, config)
|
13
|
+
field_def = config.search_fields[key]
|
14
14
|
|
15
15
|
(field_def[:solr_parameters] || {}).merge(field_def[:solr_local_parameters] || {})
|
16
16
|
end
|
@@ -12,7 +12,7 @@ module BlacklightAdvancedSearch::RenderConstraintsOverride
|
|
12
12
|
else
|
13
13
|
content = ""
|
14
14
|
@advanced_query.keyword_queries.each_pair do |field, query|
|
15
|
-
label =
|
15
|
+
label = search_field_def_for_key(field)[:display_label]
|
16
16
|
content << render_constraint_element(
|
17
17
|
label, query,
|
18
18
|
:remove =>
|
@@ -36,7 +36,7 @@ module BlacklightAdvancedSearch::RenderConstraintsOverride
|
|
36
36
|
|
37
37
|
if (@advanced_query)
|
38
38
|
@advanced_query.filters.each_pair do |field, value_list|
|
39
|
-
label =
|
39
|
+
label = facet_field_labels[field]
|
40
40
|
content << render_constraint_element(label,
|
41
41
|
value_list.join(" OR "),
|
42
42
|
:remove => catalog_index_path( remove_advanced_filter_group(field, my_params) )
|
@@ -50,11 +50,11 @@ module BlacklightAdvancedSearch::RenderConstraintsOverride
|
|
50
50
|
def render_search_to_s_filters(my_params)
|
51
51
|
content = super(my_params)
|
52
52
|
|
53
|
-
advanced_query = BlacklightAdvancedSearch::QueryParser.new(my_params,
|
53
|
+
advanced_query = BlacklightAdvancedSearch::QueryParser.new(my_params, blacklight_config )
|
54
54
|
|
55
55
|
if (advanced_query.filters.length > 0)
|
56
56
|
advanced_query.filters.each_pair do |field, values|
|
57
|
-
label =
|
57
|
+
label = facet_field_labels[field]
|
58
58
|
|
59
59
|
content << render_search_to_s_element(
|
60
60
|
label,
|
@@ -68,14 +68,14 @@ module BlacklightAdvancedSearch::RenderConstraintsOverride
|
|
68
68
|
def render_search_to_s_q(my_params)
|
69
69
|
content = super(my_params)
|
70
70
|
|
71
|
-
advanced_query = BlacklightAdvancedSearch::QueryParser.new(my_params,
|
71
|
+
advanced_query = BlacklightAdvancedSearch::QueryParser.new(my_params, blacklight_config )
|
72
72
|
|
73
73
|
if (advanced_query.keyword_queries.length > 1 &&
|
74
74
|
advanced_query.keyword_op == "OR")
|
75
75
|
# Need to do something to make the inclusive-or search clear
|
76
76
|
|
77
77
|
display_as = advanced_query.keyword_queries.collect do |field, query|
|
78
|
-
h(
|
78
|
+
h( search_field_def_for_key(field)[:display_label] + ": " + query )
|
79
79
|
end.join(" ; ")
|
80
80
|
|
81
81
|
content << render_search_to_s_element("Any of",
|
@@ -84,7 +84,7 @@ module BlacklightAdvancedSearch::RenderConstraintsOverride
|
|
84
84
|
)
|
85
85
|
elsif (advanced_query.keyword_queries.length > 0)
|
86
86
|
advanced_query.keyword_queries.each_pair do |field, query|
|
87
|
-
label =
|
87
|
+
label = search_field_def_for_key(field)[:display_label]
|
88
88
|
|
89
89
|
content << render_search_to_s_element(label, query)
|
90
90
|
end
|
@@ -1,45 +1,40 @@
|
|
1
|
-
# Copy BlacklightAdvancedSearch assets to public folder in current app.
|
2
|
-
# If you want to do this on application startup, you can
|
3
|
-
# add this next line to your one of your environment files --
|
4
|
-
# generally you'd only want to do this in 'development', and can
|
5
|
-
# add it to environments/development.rb:
|
6
|
-
# require File.join(BlacklightAdvancedSearch.root, "lib", "generators", "blacklight", "assets_generator.rb")
|
7
|
-
# BlacklightAdvancedSearch::AssetsGenerator.start(["--force", "--quiet"])
|
8
|
-
|
9
|
-
|
10
|
-
# Need the requires here so we can call the generator from environment.rb
|
11
|
-
# as suggested above.
|
12
|
-
require 'rails/generators'
|
13
|
-
require 'rails/generators/base'
|
14
|
-
module BlacklightAdvancedSearch
|
15
|
-
class AssetsGenerator < Rails::Generators::Base
|
16
|
-
source_root File.join(BlacklightAdvancedSearch::Engine.root, 'app', 'assets')
|
17
|
-
|
18
|
-
def assets
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
1
|
+
# Copy BlacklightAdvancedSearch assets to public folder in current app.
|
2
|
+
# If you want to do this on application startup, you can
|
3
|
+
# add this next line to your one of your environment files --
|
4
|
+
# generally you'd only want to do this in 'development', and can
|
5
|
+
# add it to environments/development.rb:
|
6
|
+
# require File.join(BlacklightAdvancedSearch.root, "lib", "generators", "blacklight", "assets_generator.rb")
|
7
|
+
# BlacklightAdvancedSearch::AssetsGenerator.start(["--force", "--quiet"])
|
8
|
+
|
9
|
+
|
10
|
+
# Need the requires here so we can call the generator from environment.rb
|
11
|
+
# as suggested above.
|
12
|
+
require 'rails/generators'
|
13
|
+
require 'rails/generators/base'
|
14
|
+
module BlacklightAdvancedSearch
|
15
|
+
class AssetsGenerator < Rails::Generators::Base
|
16
|
+
source_root File.join(BlacklightAdvancedSearch::Engine.root, 'app', 'assets')
|
17
|
+
|
18
|
+
def assets
|
19
|
+
original_css = File.binread("app/assets/stylesheets/application.css")
|
20
|
+
if original_css.include?("require 'blacklight_advanced_search'")
|
21
|
+
say_status("skipped", "insert into app/assets/stylesheets/application.css", :yellow)
|
22
|
+
else
|
23
|
+
insert_into_file "app/assets/stylesheets/application.css", :before => "*/" do
|
24
|
+
"\n *= require 'blacklight_advanced_search'\n\n"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
original_js = File.binread("app/assets/javascripts/application.js")
|
29
|
+
if original_js.include?("require 'blacklight_advanced_search'")
|
30
|
+
say_status("skipped", "insert into app/assets/javascripts/application.js", :yellow)
|
31
|
+
else
|
32
|
+
insert_into_file "app/assets/javascripts/application.js", :after => %r{//= require ['"]?jquery['"]?$} do
|
33
|
+
"\n//= require 'blacklight_advanced_search'\n\n"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
@@ -8,10 +8,8 @@ class BlacklightAdvancedSearchGenerator < Rails::Generators::Base
|
|
8
8
|
BlacklightAdvancedSearch::AssetsGenerator.start
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
12
|
-
|
13
|
-
copy_file("blacklight_advanced_search_config.rb", "config/initializers/blacklight_advanced_search.rb")
|
14
|
-
end
|
11
|
+
def install_local_controller
|
12
|
+
copy_file("advanced_controller.rb", "app/controllers/advanced_controller.rb")
|
15
13
|
end
|
16
14
|
|
17
15
|
def install_localized_search_form
|
@@ -0,0 +1,57 @@
|
|
1
|
+
class AdvancedController < BlacklightAdvancedSearch::AdvancedController
|
2
|
+
|
3
|
+
blacklight_config.configure do |config|
|
4
|
+
# name of Solr request handler, leave unset to use the same one as your Blacklight.config[:default_qt]
|
5
|
+
config.advanced_search.qt = 'advanced'
|
6
|
+
|
7
|
+
##
|
8
|
+
# The advanced search form displays facets as a limit option.
|
9
|
+
# By default it will use whatever facets, if any, are returned
|
10
|
+
# by the Solr qt request handler in use. However, you can use
|
11
|
+
# this config option to have it request other facet params than
|
12
|
+
# default in the Solr request handler, in desired.
|
13
|
+
config.advanced_search.form_solr_parameters = {}
|
14
|
+
|
15
|
+
# name of key in Blacklight URL, no reason to change usually.
|
16
|
+
config.advanced_search.url_key = 'advanced'
|
17
|
+
|
18
|
+
# We are going to completely override the inherited search fields
|
19
|
+
config.search_fields.clear
|
20
|
+
|
21
|
+
config.add_search_field 'author' do |field|
|
22
|
+
field.solr_local_parameters = {
|
23
|
+
:pf => "$pf_author",
|
24
|
+
:qf => "$qf_author"
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
config.add_search_field 'title' do |field|
|
29
|
+
field.solr_local_parameters = {
|
30
|
+
:pf => "$pf_title",
|
31
|
+
:qf => "$qf_title"
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
config.add_search_field 'subject' do |field|
|
36
|
+
field.solr_local_parameters = {
|
37
|
+
:pf => "$pf_subject",
|
38
|
+
:qf => "$qf_subject"
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
config.add_search_field 'keyword' do |field|
|
43
|
+
field.solr_local_parameters = {
|
44
|
+
:pf => "$pf_keyword",
|
45
|
+
:qf => "$qf_keyword"
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
config.add_search_field 'number' do |field|
|
50
|
+
field.solr_local_parameters = {
|
51
|
+
:pf => "$pf_number",
|
52
|
+
:qf => "$qf_number"
|
53
|
+
}
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
metadata
CHANGED
@@ -1,76 +1,57 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight_advanced_search
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 1
|
9
|
-
- 2
|
10
|
-
version: 1.1.2
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Jonathan Rochkind
|
14
9
|
- Chris Beer
|
15
10
|
autorequire:
|
16
11
|
bindir: bin
|
17
12
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
- !ruby/object:Gem::Dependency
|
13
|
+
date: 2011-12-16 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
22
16
|
name: rails
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: &2152619380 !ruby/object:Gem::Requirement
|
25
18
|
none: false
|
26
|
-
requirements:
|
19
|
+
requirements:
|
27
20
|
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 3
|
32
|
-
- 0
|
33
|
-
version: "3.0"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3.0'
|
34
23
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: blacklight
|
38
24
|
prerelease: false
|
39
|
-
|
25
|
+
version_requirements: *2152619380
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: blacklight
|
28
|
+
requirement: &2152618720 !ruby/object:Gem::Requirement
|
40
29
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
segments:
|
46
|
-
- 0
|
47
|
-
version: "0"
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.2.1
|
48
34
|
type: :runtime
|
49
|
-
version_requirements: *id002
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
name: parslet
|
52
35
|
prerelease: false
|
53
|
-
|
36
|
+
version_requirements: *2152618720
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: parslet
|
39
|
+
requirement: &2152618160 !ruby/object:Gem::Requirement
|
54
40
|
none: false
|
55
|
-
requirements:
|
56
|
-
- -
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
|
59
|
-
segments:
|
60
|
-
- 0
|
61
|
-
version: "0"
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
62
45
|
type: :runtime
|
63
|
-
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *2152618160
|
64
48
|
description:
|
65
|
-
email:
|
49
|
+
email:
|
66
50
|
- blacklight-development@googlegroups.com
|
67
51
|
executables: []
|
68
|
-
|
69
52
|
extensions: []
|
70
|
-
|
71
53
|
extra_rdoc_files: []
|
72
|
-
|
73
|
-
files:
|
54
|
+
files:
|
74
55
|
- .gitignore
|
75
56
|
- LICENSE
|
76
57
|
- README.rdoc
|
@@ -80,13 +61,16 @@ files:
|
|
80
61
|
- app/assets/javascripts/blacklight_advanced_search/blacklight_advanced_search_javascript.js
|
81
62
|
- app/assets/stylesheets/blacklight_advanced_search.css
|
82
63
|
- app/assets/stylesheets/blacklight_advanced_search/advanced_results.css
|
83
|
-
- app/assets/stylesheets/blacklight_advanced_search/blacklight_advanced_search_styles.css
|
64
|
+
- app/assets/stylesheets/blacklight_advanced_search/blacklight_advanced_search_styles.css.scss
|
84
65
|
- app/controllers/advanced_controller.rb
|
66
|
+
- app/controllers/blacklight_advanced_search/advanced_controller.rb
|
85
67
|
- app/helpers/advanced_helper.rb
|
86
68
|
- app/views/advanced/_advanced_search_facets.html.erb
|
87
69
|
- app/views/advanced/_advanced_search_fields.html.erb
|
88
70
|
- app/views/advanced/_advanced_search_form.html.erb
|
89
71
|
- app/views/advanced/_advanced_search_help.html.erb
|
72
|
+
- app/views/advanced/_facet_layout.html.erb
|
73
|
+
- app/views/advanced/_facet_limit.html.erb
|
90
74
|
- app/views/advanced/index.html.erb
|
91
75
|
- app/views/blacklight_advanced_search/_facet_limit.html.erb
|
92
76
|
- blacklight_advanced_search.gemspec
|
@@ -104,7 +88,7 @@ files:
|
|
104
88
|
- lib/generators/blacklight_advanced_search/assets_generator.rb
|
105
89
|
- lib/generators/blacklight_advanced_search/blacklight_advanced_search_generator.rb
|
106
90
|
- lib/generators/blacklight_advanced_search/templates/_search_form.html.erb
|
107
|
-
- lib/generators/blacklight_advanced_search/templates/
|
91
|
+
- lib/generators/blacklight_advanced_search/templates/advanced_controller.rb
|
108
92
|
- lib/parsing_nesting/Readme.rdoc
|
109
93
|
- lib/parsing_nesting/grammar.rb
|
110
94
|
- lib/parsing_nesting/tree.rb
|
@@ -119,38 +103,29 @@ files:
|
|
119
103
|
- uninstall.rb
|
120
104
|
homepage: http://projectblacklight.org/
|
121
105
|
licenses: []
|
122
|
-
|
123
106
|
post_install_message:
|
124
107
|
rdoc_options: []
|
125
|
-
|
126
|
-
require_paths:
|
108
|
+
require_paths:
|
127
109
|
- lib
|
128
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
129
111
|
none: false
|
130
|
-
requirements:
|
131
|
-
- -
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
|
134
|
-
|
135
|
-
- 0
|
136
|
-
version: "0"
|
137
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ! '>='
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
117
|
none: false
|
139
|
-
requirements:
|
140
|
-
- -
|
141
|
-
- !ruby/object:Gem::Version
|
142
|
-
|
143
|
-
segments:
|
144
|
-
- 0
|
145
|
-
version: "0"
|
118
|
+
requirements:
|
119
|
+
- - ! '>='
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
146
122
|
requirements: []
|
147
|
-
|
148
123
|
rubyforge_project: blacklight
|
149
|
-
rubygems_version: 1.
|
124
|
+
rubygems_version: 1.8.10
|
150
125
|
signing_key:
|
151
126
|
specification_version: 3
|
152
127
|
summary: Blacklight Advanced Search plugin
|
153
|
-
test_files:
|
128
|
+
test_files:
|
154
129
|
- spec/lib/filter_parser_spec.rb
|
155
130
|
- spec/parsing_nesting/build_tree_spec.rb
|
156
131
|
- spec/parsing_nesting/consuming_spec.rb
|
data/lib/generators/blacklight_advanced_search/templates/blacklight_advanced_search_config.rb
DELETED
@@ -1,86 +0,0 @@
|
|
1
|
-
##
|
2
|
-
# This example config file is set up to work using the Solr request handler
|
3
|
-
# called "advanced" in the example Blacklight solrconfig.xml:
|
4
|
-
# http://github.com/projectblacklight/blacklight-jetty/blob/master/solr/conf/solrconfig.xml
|
5
|
-
#
|
6
|
-
# NOTE WELL: Using a seperate request handler is just one option, in most cases
|
7
|
-
# it's simpler to use your default solr request handler set in Blacklight itself,
|
8
|
-
# in which case you can delete/comment out this entire file!
|
9
|
-
# See README.
|
10
|
-
|
11
|
-
BlacklightAdvancedSearch.config.merge!(
|
12
|
-
# :search_field => "advanced", # name of key in Blacklight URL, no reason to change usually.
|
13
|
-
|
14
|
-
# Set advanced_parse_q to true to allow AND/OR/NOT in your basic/simple
|
15
|
-
# Blacklight search, parsed by Advanced Search Plugin.
|
16
|
-
#:advanced_parse_q => true,
|
17
|
-
|
18
|
-
:qt => "advanced" # name of Solr request handler, leave unset to use the same one as your Blacklight.config[:default_qt]
|
19
|
-
|
20
|
-
)
|
21
|
-
|
22
|
-
|
23
|
-
# You don't need to specify search_fields, if you leave :qt unspecified
|
24
|
-
# above, and have search field config in Blacklight already using that
|
25
|
-
# same qt, the plugin will simply use them. But if you'd like to use a
|
26
|
-
# different solr qt request handler, or have another reason for wanting
|
27
|
-
# to manually specify search fields, you can. Uses the hash format
|
28
|
-
# specified in Blacklight::SearchFields
|
29
|
-
|
30
|
-
BlacklightAdvancedSearch.config[:search_fields] = search_fields = []
|
31
|
-
search_fields << {
|
32
|
-
:key => 'author',
|
33
|
-
:solr_local_parameters => {
|
34
|
-
:pf => "$pf_author",
|
35
|
-
:qf => "$qf_author"
|
36
|
-
}
|
37
|
-
}
|
38
|
-
|
39
|
-
search_fields << {
|
40
|
-
:key => 'title',
|
41
|
-
:solr_local_parameters => {
|
42
|
-
:pf => "$pf_title",
|
43
|
-
:qf => "$qf_title"
|
44
|
-
}
|
45
|
-
}
|
46
|
-
|
47
|
-
search_fields << {
|
48
|
-
:key => 'subject',
|
49
|
-
:solr_local_parameters => {
|
50
|
-
:pf => "$pf_subject",
|
51
|
-
:qf => "$qf_subject"
|
52
|
-
}
|
53
|
-
}
|
54
|
-
|
55
|
-
search_fields << {
|
56
|
-
:key => 'keyword',
|
57
|
-
:solr_local_parameters => {
|
58
|
-
:pf => "$pf_keyword",
|
59
|
-
:qf => "$qf_keyword"
|
60
|
-
}
|
61
|
-
}
|
62
|
-
|
63
|
-
search_fields << {
|
64
|
-
:key => 'numbers',
|
65
|
-
:solr_local_parameters => {
|
66
|
-
:pf => "$pf_number",
|
67
|
-
:qf => "$qf_number"
|
68
|
-
}
|
69
|
-
}
|
70
|
-
|
71
|
-
##
|
72
|
-
# The advanced search form displays facets as a limit option.
|
73
|
-
# By default it will use whatever facets, if any, are returned
|
74
|
-
# by the Solr qt request handler in use. However, you can use
|
75
|
-
# this config option to have it request other facet params than
|
76
|
-
# default in the Solr request handler, in desired.
|
77
|
-
|
78
|
-
# BlacklightAdvancedSearch.config[:form_solr_parameters] = {
|
79
|
-
# "facet.field" => [
|
80
|
-
# "format",
|
81
|
-
# "lc_1letter_facet",
|
82
|
-
# "language_facet"
|
83
|
-
# ],
|
84
|
-
# "facet.limit" => -1, # all facet values
|
85
|
-
# "facet.sort" => "index" # sort by index value (alphabetically, more or less)
|
86
|
-
# }
|