paper_type facets

This commit is contained in:
Lars Henrik Mai 2015-06-13 21:18:55 +02:00 committed by Andreas Haller
parent 5b677ab3ca
commit f709c399be
3 changed files with 32 additions and 1 deletions

View file

@ -1,5 +1,7 @@
class SearchController < ApplicationController
def index
@papers = Paper.search(params[:q]).page(params[:page]).results
@response = Paper.search(params[:q])
@papers = @response.page(params[:page]).results
@paper_type_facets = @response.response['aggregations']['paper_types']['buckets'].map {|h| [ h['key'], h['doc_count']] }
end
end