aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/public_body_controller.rb
diff options
context:
space:
mode:
authorSeb Bacon <seb.bacon@gmail.com>2011-09-05 12:32:17 +0100
committerSeb Bacon <seb.bacon@gmail.com>2011-09-05 12:32:17 +0100
commit7f0ae82d44873b53cc87c659b42415ce4866c7b4 (patch)
treefdce14b0658bb05aef087dd4e09dc25c9a79ea8c /app/controllers/public_body_controller.rb
parent2926ee877bcf8974c529e1271ded42971fe0d632 (diff)
parent96c4dd912083edcd0c9eda76bd2301bb4a1a6d53 (diff)
Merge branch 'develop' of github.com:sebbacon/alaveteli into develop, fix conflicts
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 378dd58e3..0e58b7055 100644
--- a/app/controllers/public_body_controller.rb
+++ b/app/controllers/public_body_controller.rb
@@ -176,5 +176,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