1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-02-01 03:57:15 +00:00

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
This commit is contained in:
Jean-Philippe Lang 2014-12-26 12:03:01 +00:00
parent 3fcd683e6b
commit 14074fa4c2
2 changed files with 4 additions and 3 deletions

View 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='?')

View 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}