diff --git a/lib/gollum/frontend/app.rb b/lib/gollum/frontend/app.rb index 1d6d8b06..eadc19e4 100644 --- a/lib/gollum/frontend/app.rb +++ b/lib/gollum/frontend/app.rb @@ -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