Sha256: 29309cf8cf18ce7e419d28455a38d0376f31569d35fb38cb8b784ebf39f41e8c

Contents?: true

Size: 637 Bytes

Versions: 11

Compression:

Stored size: 637 Bytes

Contents

module Sunspot
  class Search
    class FacetRow
      attr_reader :value, :count
      attr_writer :instance #:nodoc:

      def initialize(value, count, facet) #:nodoc:
        @value, @count, @facet = value, count, facet
      end

      # 
      # Return the instance referenced by this facet row. Only valid for field
      # facets whose fields are defined with the :references key.
      #
      def instance
        if !defined?(@instance)
          @facet.populate_instances
        end
        @instance
      end

      def inspect
        "<Sunspot::Search::FacetRow:#{value.inspect} (#{count})>"
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
sunspot-1.0.5 lib/sunspot/search/facet_row.rb
sunspot-1.0.4 lib/sunspot/search/facet_row.rb
sunspot-1.0.3 lib/sunspot/search/facet_row.rb
sunspot-1.0.2 lib/sunspot/search/facet_row.rb
sunspot-1.0.1 lib/sunspot/search/facet_row.rb
sunspot-1.0.0 lib/sunspot/search/facet_row.rb
sunspot-0.10.9 lib/sunspot/search/facet_row.rb
sunspot-0.10.8 lib/sunspot/search/facet_row.rb
nxa-sunspot-0.10.7 lib/sunspot/search/facet_row.rb
sunspot-0.10.7 lib/sunspot/search/facet_row.rb
sunspot-0.10.6 lib/sunspot/search/facet_row.rb