From 2fe806a4a49cc3fcd7c2b7fe3a385d3a46ffbfd5 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Fri, 12 Dec 2014 20:49:31 +0000 Subject: Rewrites search engine to properly paginate results (#18631). Instead of counting and retrieving results based on their timestamps, we now load all result ids then load the appropriate results by their ids. This also brings a 2x performance improvement as we search tokens in one of the 2 queries only. git-svn-id: http://svn.redmine.org/redmine/trunk@13739 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/document.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/models/document.rb') diff --git a/app/models/document.rb b/app/models/document.rb index 70e3c9b01..810b15dfa 100644 --- a/app/models/document.rb +++ b/app/models/document.rb @@ -22,7 +22,7 @@ class Document < ActiveRecord::Base acts_as_attachable :delete_permission => :delete_documents acts_as_searchable :columns => ['title', "#{table_name}.description"], - :scope => preload(:project) + :preload => :project acts_as_event :title => Proc.new {|o| "#{l(:label_document)}: #{o.title}"}, :author => Proc.new {|o| o.attachments.reorder("#{Attachment.table_name}.created_on ASC").first.try(:author) }, :url => Proc.new {|o| {:controller => 'documents', :action => 'show', :id => o.id}} -- cgit v1.2.3