Class SearchesController
In: app/controllers/searches_controller.rb
Parent: ApplicationController

Methods

Public Instance methods

[Source]

    # File app/controllers/searches_controller.rb, line 36
36:   def create
37:     if !@query.nil?
38:       @logis = WillPaginate::Collection.create(
39:           (params[:page] || 1), 8) do |pager|
40:         search = ActsAsXapian::Search.new([Logi], @query,
41:             :offset => pager.offset, :limit => pager.per_page)
42:         # inject the result array into the paginated collection:
43:         pager.replace(search.results.collect {|r| r[:model]})
44: 
45:         unless pager.total_entries
46:           # the pager didn't manage to guess the total count, do it manually
47:           pager.total_entries = search.matches_estimated
48:         end
49:       end
50:     end
51:   end

Filter functions

[Source]

    # File app/controllers/searches_controller.rb, line 73
73:   def get_query
74:     @query = params[:query]
75:   end

Search

[Source]

    # File app/controllers/searches_controller.rb, line 32
32:   def index
33:     render :action => 'create'
34:   end

Url-bars for searching.

[Source]

    # File app/controllers/searches_controller.rb, line 67
67:   def navigation_bar_search
68:     render_body 'navigation_bar_search'
69:   end

[Source]

    # File app/controllers/searches_controller.rb, line 77
77:   def page_name
78:     @page_name = t 'c.searches.page_name.index'
79:     if params[:query]
80:       @page_name += ': ' + params[:query]
81:     end
82:   end

Body-methods

[Source]

    # File app/controllers/searches_controller.rb, line 55
55:   def tag_sets
56:     # MAYDO: Can be optimized by having a special TagSet class in the
57:     # search index
58:     if !@query.nil?
59:       @tag_set_links = Context.extract_tag_set_links(
60:           LogiLogiXapian.search([Logi], @query))
61:       render_body 'logis/tag_sets'
62:     end
63:   end

[Validate]