diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 14ba250..ba80544 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -6,7 +6,7 @@ class SearchController < ApplicationController @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']] } + @paper_type_facets = @response.response['aggregations']['paper_types']['buckets'] + @originator_facets = @response.response['aggregations']['originators']['buckets'] end end diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index d1c5945..3491258 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -2,9 +2,9 @@ module SearchHelper def facet_list(facets) return unless facets.present? content_tag(:ul) do - facets.each do |term, count| + facets.each do |facet| concat content_tag(:li, - "#{term} (#{count})", + "#{facet['key']} (#{facet['doc_count']})", class: "facet" ) end