Sha256: 4187ad68309188fe1acc4cd44ba5070eaa6fa4d5c4c5a43d7dda9f8c2a2d19a3

Contents?: true

Size: 882 Bytes

Versions: 11

Compression:

Stored size: 882 Bytes

Contents

module Sunspot
  # This class encapsulates a facet row (value) for a facet.
  class FacetRow
    def initialize(pair, facet) #:nodoc:
      @pair, @facet = pair, facet
    end

    # The value associated with the facet. This will be cast according to the
    # field's type; so, for an integer field, this method will return an
    # integer, etc.
    #
    # Note that <strong>+Time+ fields will always return facet values in
    # UTC</strong>.
    #
    # ==== Returns
    #
    # Object:: The value associated with the row, cast to the appropriate type
    #
    def value
      @value ||= @facet.field.cast(@pair[0])
    end

    # The number of documents matching the search parameters that have this
    # value in the facet's field.
    #
    # ==== Returns
    #
    # Integer:: Document count for this value
    #
    def count
      @count ||= @pair[1]
    end
  end
end

Version data entries

11 entries across 11 versions & 4 rubygems

Version Path
Chrononaut-sunspot-client-0.9.4 lib/sunspot/facet_row.rb
UnderpantsGnome-sunspot-0.9.1.1 lib/sunspot/facet_row.rb
kuahyeow-sunspot-0.9.7 lib/sunspot/facet_row.rb
kuahyeow-sunspot-0.9.8 lib/sunspot/facet_row.rb
outoftime-sunspot-0.9.0 lib/sunspot/facet_row.rb
outoftime-sunspot-0.9.1 lib/sunspot/facet_row.rb
outoftime-sunspot-0.9.2 lib/sunspot/facet_row.rb
outoftime-sunspot-0.9.3 lib/sunspot/facet_row.rb
outoftime-sunspot-0.9.4 lib/sunspot/facet_row.rb
outoftime-sunspot-0.9.5 lib/sunspot/facet_row.rb
outoftime-sunspot-0.9.6 lib/sunspot/facet_row.rb