diff options
author | Seb Bacon <seb.bacon@gmail.com> | 2011-09-01 18:15:57 +0100 |
---|---|---|
committer | Seb Bacon <seb.bacon@gmail.com> | 2011-09-01 18:15:57 +0100 |
commit | 547394f4aa7d48b42b14a4b08c98e3c60a33db46 (patch) | |
tree | 83fc695a06d28fdbd500d5f438f0b7a2d189eb6b /app/controllers/user_controller.rb | |
parent | 19c63da981d6348f9f7b8c8f814319697be1e0c6 (diff) |
Provide a search function on the user profile pages. Closes #138.
Diffstat (limited to 'app/controllers/user_controller.rb')
-rw-r--r-- | app/controllers/user_controller.rb | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 6916b4456..47a133135 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -33,9 +33,16 @@ class UserController < ApplicationController # Use search query for this so can collapse and paginate easily # XXX really should just use SQL query here rather than Xapian. begin - @xapian_requests = perform_search([InfoRequestEvent], 'requested_by:' + @display_user.url_name, 'newest', 'request_collapse') - @xapian_comments = perform_search([InfoRequestEvent], 'commented_by:' + @display_user.url_name, 'newest', nil) - + requests_query = 'requested_by:' + @display_user.url_name + comments_query = 'commented_by:' + @display_user.url_name + if !params[:user_query].nil? + requests_query += " " + params[:user_query] + comments_query += " " + params[:user_query] + @match_phrase = _("{{search_results}} matching '{{query}}'", :search_results => "", :query => params[:user_query]) + end + @xapian_requests = perform_search([InfoRequestEvent], requests_query, 'newest', 'request_collapse') + @xapian_comments = perform_search([InfoRequestEvent], comments_query, 'newest', nil) + if (@page > 1) @page_desc = " (page " + @page.to_s + ")" else |