stadtratmonitor/app/controllers/search_controller.rb

12 lines
500 B
Ruby
Raw Normal View History

class SearchController < ApplicationController
def index
2015-06-22 20:38:24 +02:00
@paper_type = params[:paper_type]
options = params.slice(:paper_type)
@response = Paper.search(params[:q], options)
2015-06-13 21:18:55 +02:00
@papers = @response.page(params[:page]).results
@paper_type_facets = @response.response['aggregations']['paper_types']['buckets'].map {|h| [ h['key'], h['doc_count']] }
2015-06-13 21:27:22 +02:00
@originator_facets = @response.response['aggregations']['originators']['buckets'].map {|h| [ h['key'], h['doc_count']] }
end
end