add filter by paper_type

This commit is contained in:
Lars Henrik Mai 2015-06-22 20:38:24 +02:00 committed by Andreas Haller
parent 7a7083c2ad
commit 41ed4a9674
2 changed files with 27 additions and 9 deletions

View file

@ -1,6 +1,9 @@
class SearchController < ApplicationController
def index
@response = Paper.search(params[:q])
@paper_type = params[:paper_type]
options = params.slice(:paper_type)
@response = Paper.search(params[:q], options)
@papers = @response.page(params[:page]).results
@paper_type_facets = @response.response['aggregations']['paper_types']['buckets'].map {|h| [ h['key'], h['doc_count']] }
@originator_facets = @response.response['aggregations']['originators']['buckets'].map {|h| [ h['key'], h['doc_count']] }