blacklight_advanced_search 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -78,7 +78,7 @@ The optional installer script can install a sample blacklight_advanced_search.rb
78
78
 
79
79
  If you turn on this feature with `BlacklightAdvancedSearch.config[: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
80
 
81
- 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.
81
+ 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
82
 
83
83
  Due to limitations of the logic, sometimes these generated Solr queries may not really be as simple as they could be, they may include a *single* nested _query_, which really doens't need to be a nested query at all, although it will still work fine.
84
84
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.1.0
@@ -0,0 +1,5 @@
1
+ // Master manifest file for engine, so local app can require
2
+ // this one file, but get all our files -- and local app
3
+ // require does not need to change if we change file list.
4
+
5
+ //= require_tree './blacklight_advanced_search'
@@ -0,0 +1,6 @@
1
+ /* Master manifest file for engine, so local app can require
2
+ * this one file, but get all our files -- and local app
3
+ * require does not need to change if we change file list.
4
+ *
5
+ *= require_tree './blacklight_advanced_search'
6
+ */
@@ -3,7 +3,7 @@
3
3
  class AdvancedController < CatalogController
4
4
  include AdvancedHelper # so we get the #advanced_search_context method
5
5
 
6
- before_filter :setup_advanced_search_css, :setup_advanced_search_js, :only => :index
6
+ before_filter :setup_advanced_search_assets, :only => :index
7
7
 
8
8
  def index
9
9
  unless request.method==:post
@@ -53,10 +53,11 @@ class AdvancedController < CatalogController
53
53
 
54
54
  Blacklight.solr.find(input.to_hash)
55
55
  end
56
- def setup_advanced_search_css
57
- stylesheet_links << ["blacklight_advanced_search_styles", {:plugin=>:blacklight_advanced_search}]
58
- end
59
- def setup_advanced_search_js
60
- javascript_includes << ["blacklight_advanced_search_javascript", {:plugin=>:blacklight_advanced_search}]
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
61
  end
62
+
62
63
  end
@@ -70,5 +70,9 @@ module BlacklightAdvancedSearch
70
70
  end
71
71
  return val
72
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
73
77
 
74
78
  end
@@ -13,11 +13,31 @@ require 'rails/generators'
13
13
  require 'rails/generators/base'
14
14
  module BlacklightAdvancedSearch
15
15
  class AssetsGenerator < Rails::Generators::Base
16
- source_root File.expand_path('../templates', __FILE__)
16
+ source_root File.join(BlacklightAdvancedSearch::Engine.root, 'app', 'assets')
17
17
 
18
18
  def assets
19
- directory("public/stylesheets")
20
- directory("public/javascripts")
19
+ if BlacklightAdvancedSearch.use_asset_pipeline?
20
+ original_css = File.binread("app/assets/stylesheets/application.css")
21
+ if original_css.include?("require 'blacklight_advanced_search'")
22
+ say_status("skipped", "insert into app/assets/stylesheets/application.css", :yellow)
23
+ else
24
+ insert_into_file "app/assets/stylesheets/application.css", :before => "*/" do
25
+ "\n *= require 'blacklight_advanced_search'\n\n"
26
+ end
27
+ end
28
+
29
+ original_js = File.binread("app/assets/javascripts/application.js")
30
+ if original_js.include?("require 'blacklight_advanced_search'")
31
+ say_status("skipped", "insert into app/assets/javascripts/application.js", :yellow)
32
+ else
33
+ insert_into_file "app/assets/javascripts/application.js", :after => "//= require jquery" do
34
+ "\n//= require 'blacklight_advanced_search'\n\n"
35
+ end
36
+ end
37
+ else
38
+ directory("stylesheets/blacklight_advanced_search", "public/stylesheets")
39
+ directory("javascripts/blacklight_advanced_search", "public/javascripts")
40
+ end
21
41
  end
22
42
 
23
43
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight_advanced_search
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
+ - 1
8
9
  - 0
9
- - 0
10
- version: 1.0.0
10
+ version: 1.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jonathan Rochkind
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-09-12 00:00:00 -04:00
19
+ date: 2011-09-20 00:00:00 -04:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -77,8 +77,12 @@ files:
77
77
  - README.rdoc
78
78
  - Rakefile
79
79
  - VERSION
80
+ - app/assets/javascripts/blacklight_advanced_search.js
81
+ - app/assets/javascripts/blacklight_advanced_search/blacklight_advanced_search_javascript.js
82
+ - app/assets/stylesheets/blacklight_advanced_search.css
83
+ - app/assets/stylesheets/blacklight_advanced_search/advanced_results.css
84
+ - app/assets/stylesheets/blacklight_advanced_search/blacklight_advanced_search_styles.css
80
85
  - app/controllers/advanced_controller.rb
81
- - app/controllers/application_controller.rb
82
86
  - app/helpers/advanced_helper.rb
83
87
  - app/views/advanced/_advanced_search_facets.html.erb
84
88
  - app/views/advanced/_advanced_search_fields.html.erb
@@ -102,9 +106,6 @@ files:
102
106
  - lib/generators/blacklight_advanced_search/blacklight_advanced_search_generator.rb
103
107
  - lib/generators/blacklight_advanced_search/templates/_search_form.html.erb
104
108
  - lib/generators/blacklight_advanced_search/templates/blacklight_advanced_search_config.rb
105
- - lib/generators/blacklight_advanced_search/templates/public/javascripts/blacklight_advanced_search_javascript.js
106
- - lib/generators/blacklight_advanced_search/templates/public/stylesheets/advanced_results.css
107
- - lib/generators/blacklight_advanced_search/templates/public/stylesheets/blacklight_advanced_search_styles.css
108
109
  - lib/parsing_nesting/Readme.rdoc
109
110
  - lib/parsing_nesting/grammar.rb
110
111
  - lib/parsing_nesting/tree.rb
@@ -1,5 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- helper :all # include all helpers, all the time
3
- protect_from_forgery # See ActionController::RequestForgeryProtection for details
4
-
5
- end