Class: Sunspot::InstantiatedFacetRow

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

Overview

InstantiatedFacetRow objects represent a single value for an instantiated facet. As well as the usual FacetRow methods, InstantedFacetRow objects provide access to the persistent object referenced by the row’s value.

Instance Attribute Summary collapse

Attributes inherited from FacetRow

#count, #value

Instance Method Summary collapse

Constructor Details

#initialize(value, count, facet) ⇒ InstantiatedFacetRow

:nodoc:



10
11
12
13
# File 'lib/sunspot/instantiated_facet_row.rb', line 10

def initialize(value, count, facet) #:nodoc:
  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.



20
21
22
23
24
25
# File 'lib/sunspot/instantiated_facet_row.rb', line 20

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