Search
What do you think would be involved in adding a search capability to Smeagol? One of the great advantages of Gollum is the super-fast git-backed search.
Can you send me a link to info on the Gollum search? I haven't see that before.
Oh sure - it's dead simple - just calls out to git grep. Lines 432-450 here: https://github.com/github/gollum/blob/master/lib/gollum/wiki.rb
And then in front end:
https://github.com/github/gollum/blob/master/lib/gollum/frontend/app.rb there's a /search route.
Search functionality would be a sweet addition, if anyone wants to submit a patch.
Is there any progress on this feature?
As Atalanta pointed out we get search for free out of what is now gollum-lib. So it's pretty trivial to get this started on the backend, it just needs a view and I haven't quite mastered how smeagol is rendering.
Outside of the rendering issue, the method is going to look very close to this (most of which is taken from here):
get '/search' do
@query = params[:q]
wiki = Smeagol::Wiki.new(repository.path, :base_path => mount_path)
# 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
Any chance to have this feature one day ?
I 'd like also to get the search feature available.