diff options
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/public_body_controller.rb | 12 | ||||
-rw-r--r-- | app/controllers/request_controller.rb | 6 |
2 files changed, 17 insertions, 1 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 diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index f36fae463..d39b78f36 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -22,6 +22,10 @@ class RequestController < ApplicationController rescue MissingSourceFile, NameError end + def select_authority + medium_cache + end + def show medium_cache @locale = self.locale_from_params() @@ -66,7 +70,7 @@ class RequestController < ApplicationController @last_info_request_event_id = @info_request.last_event_id_needing_description @new_responses_count = @info_request.events_needing_description.select {|i| i.event_type == 'response'}.size -1 + # Sidebar stuff # ... requests that have similar imporant terms behavior_cache :tag => ['similar', @info_request.id] do |