aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeb Bacon <seb.bacon@gmail.com>2012-01-13 10:31:23 +0000
committerSeb Bacon <seb.bacon@gmail.com>2012-01-13 10:31:23 +0000
commitec7a0c92f2b09c6b4d4d747d0b492bf9bd45c8ac (patch)
treed6c9eb41b0d1d561807282e58445f313795d6f93
parent840bc470558ffd34e7157dbdeb67572273445aa8 (diff)
Fix further special character searches as per issue #328
-rw-r--r--app/controllers/application_controller.rb1
-rw-r--r--spec/controllers/request_controller_spec.rb3
2 files changed, 3 insertions, 1 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 7aa522389..24268db90 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -372,6 +372,7 @@ class ApplicationController < ActionController::Base
# allowing a parameter to perform_search to control the
# default operator!
query = query.strip.gsub(/(\s-\s|&)/, "")
+ query = query.strip.gsub(/(\s-\s|&|\(|\))/, "")
query = query.split(/ +(?![-+]+)/)
if query.last.nil? || query.last.strip.length < 3
xapian_requests = nil
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index 96786a0a3..a3acd2ff5 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -1509,7 +1509,8 @@ describe RequestController, "when doing type ahead searches" do
for phrase in ["Marketing/PR activities - Aldborough E-Act Free Schoo",
"Request for communications between DCMS/Ed Vaizey and ICO from Jan 1st 2011 - May ",
"Bellevue Road Ryde Isle of Wight PO33 2AR - what is the",
- "NHS Ayrshire & Arran"]
+ "NHS Ayrshire & Arran",
+ "uda ( units of dent"]
lambda {
get :search_typeahead, :q => phrase
}.should_not raise_error(StandardError)