]> source.dussan.org Git - redmine.git/commitdiff
Converts timestamps to integers in #search_result_ranks_and_ids.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 26 Dec 2014 12:03:01 +0000 (12:03 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 26 Dec 2014 12:03:01 +0000 (12:03 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@13811 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/plugins/acts_as_searchable/lib/acts_as_searchable.rb
lib/redmine/search.rb

index 35ee265deaed9b1eae1af51f4074b30dd2def0cf..248077472104eb1c7bff95e7cfc9ab4c64510eab 100644 (file)
@@ -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='?')
index da1d5c6f67276e0d92d25a71b5b41014e62b3337..67f654245b1310bf27cbc77f2000956aa1e159e8 100644 (file)
@@ -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}