summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-12-26 12:03:01 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-12-26 12:03:01 +0000
commit14074fa4c26c50a5754eaea4371602fa5241b6de (patch)
tree0cbc17f14b4ee221a7a2b2e4bd8f62999969e4d7 /lib
parent3fcd683e6bad87ba5df91a17c3a5933519b81320 (diff)
downloadredmine-14074fa4c26c50a5754eaea4371602fa5241b6de.tar.gz
redmine-14074fa4c26c50a5754eaea4371602fa5241b6de.zip
Converts timestamps to integers in #search_result_ranks_and_ids.
git-svn-id: http://svn.redmine.org/redmine/trunk@13811 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/plugins/acts_as_searchable/lib/acts_as_searchable.rb4
-rw-r--r--lib/redmine/search.rb3
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/plugins/acts_as_searchable/lib/acts_as_searchable.rb b/lib/plugins/acts_as_searchable/lib/acts_as_searchable.rb
index 35ee265de..248077472 100644
--- a/lib/plugins/acts_as_searchable/lib/acts_as_searchable.rb
+++ b/lib/plugins/acts_as_searchable/lib/acts_as_searchable.rb
@@ -114,7 +114,9 @@ module Redmine
where(tokens_conditions).
limit(options[:limit]).
uniq.
- pluck(searchable_options[:date_column], :id)
+ pluck(searchable_options[:date_column], :id).
+ # converts timestamps to integers for faster sort
+ map {|timestamp, id| [timestamp.to_i, id]}
end
def search_token_match_statement(column, value='?')
diff --git a/lib/redmine/search.rb b/lib/redmine/search.rb
index da1d5c6f6..67f654245 100644
--- a/lib/redmine/search.rb
+++ b/lib/redmine/search.rb
@@ -125,8 +125,7 @@ module Redmine
@scope.each do |scope|
klass = scope.singularize.camelcase.constantize
ranks_and_ids_in_scope = klass.search_result_ranks_and_ids(@tokens, User.current, @projects, @options)
- # converts timestamps to integers for faster sort
- ret += ranks_and_ids_in_scope.map {|rank, id| [scope, [rank.to_i, id]]}
+ ret += ranks_and_ids_in_scope.map {|rs| [scope, rs]}
end
# sort results, higher rank and id first
ret.sort! {|a,b| b.last <=> a.last}