Sort by filename in addition to count

This commit is contained in:
Daniel Kimsey
2012-11-05 18:01:50 -05:00
parent 5759334635
commit 93754ab32d
+2 -1
View File
@@ -306,7 +306,8 @@ module Precious
get '/search' do
@query = params[:q]
wiki = wiki_new
@results = wiki.search(@query).sort_by{ |item| item[:count] }.reverse
# Sort wiki search results by count (desc) and then by name (asc)
@results = wiki.search(@query).sort{ |a, b| (a[:count] <=> b[:count]).nonzero? || b[:name] <=> a[:name] }.reverse
@name = @query
mustache :search
end