class Blacklight::Solr::Response::GroupResponse
Attributes
Public Class Methods
Source
# File lib/blacklight/solr/response/group_response.rb, line 8 def initialize key, group, response @key = key @group = group @response = response end
Public Instance Methods
Source
# File lib/blacklight/solr/response/group_response.rb, line 39 def empty? total.zero? end
Relying on a fallback (method missing) to @response is problematic as it will not evaluate the correct ‘total` method.
Source
# File lib/blacklight/solr/response/group_response.rb, line 46 def entry_name(options) I18n.t( "blacklight.entry_name.grouped.#{key}", default: :'blacklight.entry_name.grouped.default', count: options[:count] ) end
Overridden from Blacklight::Solr::Response::PaginationMethods
to support grouped key specific i18n keys. ‘key` is the field being grouped
Source
# File lib/blacklight/solr/response/group_response.rb, line 22 def group_limit params.fetch(:'group.limit', 1).to_s.to_i end
Source
# File lib/blacklight/solr/response/group_response.rb, line 16 def groups @groups ||= group["groups"].map do |g| Blacklight::Solr::Response::Group.new g[:groupValue], g, self end end
Source
# File lib/blacklight/solr/response/group_response.rb, line 54 def method_missing meth, *args, &block if response.respond_to? meth response.send(meth, *args, &block) else super end end
Calls superclass method
Source
# File lib/blacklight/solr/response/group_response.rb, line 62 def respond_to_missing? meth, include_private = false response.respond_to?(meth) || super end
Calls superclass method
Source
# File lib/blacklight/solr/response/group_response.rb, line 32 def start params[:start].to_s.to_i end
Source
# File lib/blacklight/solr/response/group_response.rb, line 26 def total # ngroups is only available in Solr 4.1+ # fall back on the number of facet items for that field? (group["ngroups"] || (response.aggregations[key] || []).length).to_s.to_i end