diff options
author | David Cabo <david@calibea.com> | 2011-08-02 03:50:04 +0200 |
---|---|---|
committer | David Cabo <david@calibea.com> | 2011-08-02 03:50:04 +0200 |
commit | 755ac9e6e8cc194d771ee59d7fe815fe72454a85 (patch) | |
tree | d6562b02362c25ce0277a89bdb7c1db38390641f /app/controllers/public_body_controller.rb | |
parent | 18d5f7588c3040c8bce6798f9d6c9f80172c220c (diff) |
implementing new request wireframes: new page to select authority to write to
Diffstat (limited to 'app/controllers/public_body_controller.rb')
-rw-r--r-- | app/controllers/public_body_controller.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb index 05acf4868..ea1ffb619 100644 --- a/app/controllers/public_body_controller.rb +++ b/app/controllers/public_body_controller.rb @@ -168,5 +168,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 |