smeagol icon indicating copy to clipboard operation
smeagol copied to clipboard

Search

Open Atalanta opened this issue 15 years ago • 7 comments

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.

Atalanta avatar Oct 15 '11 14:10 Atalanta

Can you send me a link to info on the Gollum search? I haven't see that before.

benbjohnson avatar Oct 15 '11 20:10 benbjohnson

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.

Atalanta avatar Oct 15 '11 20:10 Atalanta

Search functionality would be a sweet addition, if anyone wants to submit a patch.

trans avatar Jul 21 '12 19:07 trans

Is there any progress on this feature?

jalberto avatar Aug 12 '13 17:08 jalberto

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

pearofducks avatar Aug 31 '13 23:08 pearofducks

Any chance to have this feature one day ?

openhoat avatar Sep 04 '14 16:09 openhoat

I 'd like also to get the search feature available.

pberto avatar Feb 20 '15 02:02 pberto