Class: Sunspot::InstantiatedFacetRow

Inherits:
FacetRow
  • Object
show all
Defined in:
lib/sunspot/instantiated_facet_row.rb

Instance Attribute Summary collapse

Attributes inherited from FacetRow

#count, #value

Instance Method Summary collapse

Constructor Details

#initialize(value, count, facet) ⇒ InstantiatedFacetRow

Returns a new instance of InstantiatedFacetRow.



5
6
7
8
# File 'lib/sunspot/instantiated_facet_row.rb', line 5

def initialize(value, count, facet)
  super(value, count)
  @facet = facet
end

Instance Attribute Details

#instanceObject

Get the persistent object referenced by this row’s value. Instances are batch-lazy-loaded, which means that for a given facet, all of the instances are loaded the first time any row’s instance is requested.



15
16
17
18
19
20
# File 'lib/sunspot/instantiated_facet_row.rb', line 15

def instance
  unless defined?(@instance)
    @facet.populate_instances!
  end
  @instance
end