diff options
author | Gareth Rees <gareth@mysociety.org> | 2014-12-08 11:50:46 +0000 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2014-12-08 11:50:46 +0000 |
commit | 5ae9efaf24f13023d77b6abd9eac2b94e56d9985 (patch) | |
tree | 66bc818595b3d2f89b95c8fa9f7586794eef5a6f /app/controllers/request_controller.rb | |
parent | a915c17bc1ce3b36eddc17294859b84212782112 (diff) | |
parent | bd3ed955718576a27a7c9194946d9721fde4c4a8 (diff) |
Merge branch '1666-related-requests-search' into rails-3-develop
Diffstat (limited to 'app/controllers/request_controller.rb')
-rw-r--r-- | app/controllers/request_controller.rb | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 9e2c291dc..346aaf384 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -900,10 +900,18 @@ class RequestController < ApplicationController # 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] - @xapian_requests = perform_search_typeahead(query, InfoRequestEvent) + # Since acts_as_xapian doesn't support the Partial match flag, we work + # around it by making the last word a wildcard, which is quite the same + @query = '' + + if params.key?(:requested_from) + @query << "requested_from:#{ params[:requested_from] } " + end + + @per_page = (params.fetch(:per_page) { 25 }).to_i + + @query << params[:q] + @xapian_requests = perform_search_typeahead(@query, InfoRequestEvent, @per_page) render :partial => "request/search_ahead" end |