aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/application_controller.rb4
-rw-r--r--spec/controllers/request_controller_spec.rb4
2 files changed, 4 insertions, 4 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 05f88a6b2..7aa522389 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -371,8 +371,8 @@ class ApplicationController < ActionController::Base
# XXX this is a result of the OR hack below -- should fix by
# allowing a parameter to perform_search to control the
# default operator!
- query = query.gsub(/(\s-\s|&)/, "")
- query = query.split(/ +(?!-)/)
+ query = query.strip.gsub(/(\s-\s|&)/, "")
+ query = query.split(/ +(?![-+]+)/)
if query.last.nil? || query.last.strip.length < 3
xapian_requests = nil
else
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index dd56d5f9e..96786a0a3 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -436,7 +436,8 @@ describe RequestController, "when searching for an authority" 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",
+ " cardiff"]
lambda {
get :select_authority, :query => phrase
}.should_not raise_error(StandardError)
@@ -1511,7 +1512,6 @@ describe RequestController, "when doing type ahead searches" do
"NHS Ayrshire & Arran"]
lambda {
get :search_typeahead, :q => phrase
- puts phrase
}.should_not raise_error(StandardError)
end
end