class Blacklight::Solr::Response::GroupResponse
Attributes
group[R]
group_field[R]
key[R]
response[R]
Public Class Methods
new(key, group, response)
click to toggle source
# File lib/blacklight/solr/response/group_response.rb, line 7 def initialize key, group, response @key = key @group = group @response = response end
Public Instance Methods
empty?()
click to toggle source
Relying on a fallback (method missing) to @response is problematic as it will not evaluate the correct `total` method.
# File lib/blacklight/solr/response/group_response.rb, line 38 def empty? total.zero? end
entry_name(options)
click to toggle source
Overridden from Blacklight::Solr::Response::PaginationMethods
to support grouped key specific i18n keys. `key` is the field being grouped
# File lib/blacklight/solr/response/group_response.rb, line 45 def entry_name(options) I18n.t( "blacklight.entry_name.grouped.#{key}", default: :'blacklight.entry_name.grouped.default', count: options[:count] ) end
group_limit()
click to toggle source
# File lib/blacklight/solr/response/group_response.rb, line 21 def group_limit params.fetch(:'group.limit', 1).to_s.to_i end
groups()
click to toggle source
# File lib/blacklight/solr/response/group_response.rb, line 15 def groups @groups ||= group["groups"].map do |g| Blacklight::Solr::Response::Group.new g[:groupValue], g, self end end
method_missing(meth, *args, &block)
click to toggle source
Calls superclass method
# File lib/blacklight/solr/response/group_response.rb, line 53 def method_missing meth, *args, &block if response.respond_to? meth response.send(meth, *args, &block) else super end end
respond_to_missing?(meth, include_private = false)
click to toggle source
Calls superclass method
# File lib/blacklight/solr/response/group_response.rb, line 61 def respond_to_missing? meth, include_private = false response.respond_to?(meth) || super end
start()
click to toggle source
# File lib/blacklight/solr/response/group_response.rb, line 31 def start params[:start].to_s.to_i end
total()
click to toggle source
# File lib/blacklight/solr/response/group_response.rb, line 25 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