Mercurial > hg > soundsoftware-site
diff app/controllers/search_controller.rb @ 499:85fd403a7daa cannam
Merge
author | Chris Cannam <chris.cannam@soundsoftware.ac.uk> |
---|---|
date | Wed, 13 Jul 2011 12:46:00 +0100 |
parents | 87bfac1079fd |
children | 851510f1b535 |
line wrap: on
line diff
--- a/app/controllers/search_controller.rb Wed Jul 13 11:59:48 2011 +0100 +++ b/app/controllers/search_controller.rb Wed Jul 13 12:46:00 2011 +0100 @@ -69,6 +69,7 @@ # no more than 5 tokens to search for @tokens.slice! 5..-1 if @tokens.size > 5 + @project_matches = [] @results = [] @results_by_type = Hash.new {|h,k| h[k] = 0} @@ -82,6 +83,12 @@ :before => params[:previous].nil?) @results += r @results_by_type[s] += c + if s == 'projects' + r, c = s.singularize.camelcase.constantize.search(@tokens, nil, + :all_words => @all_words, + :titles_only => 1) + @project_matches += r + end end @results = @results.sort {|a,b| b.event_datetime <=> a.event_datetime} if params[:previous].nil?