aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/public_body_controller.rb
diff options
context:
space:
mode:
authorDavid Cabo <david@calibea.com>2011-09-01 02:46:22 +0200
committerDavid Cabo <david@calibea.com>2011-09-01 02:46:22 +0200
commit6a7c9cdd3c5bf3db7701ef1353f04527e96c8cc3 (patch)
tree59cfc21e66fc3c44eb01991ef03f253dcaaf010d /app/controllers/public_body_controller.rb
parent1fb99a4df2514cb6aea37fcf1fd4790234d77c7e (diff)
parent88c26439d7d00cc5f0e1ddcb7b0a0036fa3f9c88 (diff)
Merge branch 'asktheeu-new-design' into develop (update New Request workflow to match new wireframes)
Diffstat (limited to 'app/controllers/public_body_controller.rb')
-rw-r--r--app/controllers/public_body_controller.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb
index 1a46cb62f..77cede36b 100644
--- a/app/controllers/public_body_controller.rb
+++ b/app/controllers/public_body_controller.rb
@@ -175,5 +175,17 @@ class PublicBodyController < ApplicationController
:filename => 'all-authorities.csv',
:disposition =>'attachment', :encoding => 'utf8')
end
+
+ # Type ahead search
+ def search_typeahead
+ # Since acts_as_xapian doesn't support the Partial match flag, we work around it
+ # by making the last work a wildcard, which is quite the same
+ query = params[:q] + '*'
+
+ query = query.split(' ').join(' OR ') # XXX: HACK for OR instead of default AND!
+ @xapian_requests = perform_search([PublicBody], query, 'relevant', 'request_collapse', 5)
+
+ render :partial => "public_body/search_ahead"
+ end
end