From be2b8a62f4d0d8bf413a5583fe644bd41a8ebf04 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 20 Jul 2008 17:26:07 +0000 Subject: Search engine: display total results count (#906) and count by result type. git-svn-id: http://redmine.rubyforge.org/svn/trunk@1681 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/issue.rb | 5 ++++- app/models/journal.rb | 6 ------ 2 files changed, 4 insertions(+), 7 deletions(-) (limited to 'app/models') diff --git a/app/models/issue.rb b/app/models/issue.rb index b19e64883..cae603dd8 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -35,7 +35,10 @@ class Issue < ActiveRecord::Base acts_as_customizable acts_as_watchable - acts_as_searchable :columns => ['subject', "#{table_name}.description"], :include => :project, :with => {:journal => :issue} + acts_as_searchable :columns => ['subject', "#{table_name}.description", "#{Journal.table_name}.notes"], + :include => [:project, :journals], + # sort by id so that limited eager loading doesn't break with postgresql + :order_column => "#{table_name}.id" acts_as_event :title => Proc.new {|o| "#{o.tracker.name} ##{o.id}: #{o.subject}"}, :url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.id}} diff --git a/app/models/journal.rb b/app/models/journal.rb index 8583f63de..a427f84e3 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -25,12 +25,6 @@ class Journal < ActiveRecord::Base has_many :details, :class_name => "JournalDetail", :dependent => :delete_all attr_accessor :indice - acts_as_searchable :columns => 'notes', - :include => {:issue => :project}, - :project_key => "#{Issue.table_name}.project_id", - :date_column => "#{Issue.table_name}.created_on", - :permission => :view_issues - acts_as_event :title => Proc.new {|o| status = ((s = o.new_status) ? " (#{s})" : nil); "#{o.issue.tracker} ##{o.issue.id}#{status}: #{o.issue.subject}" }, :description => :notes, :author => :user, -- cgit v1.2.3