Class: Ansr::Blacklight::Solr::Response::Group

Inherits:
Group
  • Object
show all
Includes:
PaginationMethods
Defined in:
lib/ansr_blacklight/solr/response/group.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(group_key, model, group, response) ⇒ Group

Returns a new instance of Group.



7
8
9
10
# File 'lib/ansr_blacklight/solr/response/group.rb', line 7

def initialize group_key, model, group, response
  super(group_key, model, group)
  @response = response
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



5
6
7
# File 'lib/ansr_blacklight/solr/response/group.rb', line 5

def response
  @response
end

Instance Method Details

#doclistObject



12
13
14
# File 'lib/ansr_blacklight/solr/response/group.rb', line 12

def doclist
  group[:doclist]
end

#docsObject



25
26
27
# File 'lib/ansr_blacklight/solr/response/group.rb', line 25

def docs
  doclist[:docs].map {|doc| model.new(doc)} #TODO do we need to have the solrResponse in the item? 
end

#fieldObject



29
30
31
# File 'lib/ansr_blacklight/solr/response/group.rb', line 29

def field
  response.group_field
end

#startObject



21
22
23
# File 'lib/ansr_blacklight/solr/response/group.rb', line 21

def start
  doclist[:start].to_s.to_i
end

#totalObject

short cut to response



17
18
19
# File 'lib/ansr_blacklight/solr/response/group.rb', line 17

def total
  doclist[:numFound].to_s.to_i
end