Sha256: 05524a07c8a31c160ebf99aadace42aeec59572d02f71e8a858c89c4670b95db

Contents?: true

Size: 1.14 KB

Versions: 22

Compression:

Stored size: 1.14 KB

Contents

module Scrivito
  # Instances of this class represent the result of a faceted search.
  #
  # @api public
  class ObjFacetValue

    def initialize(value, total, included_objs = [])
      @name = value
      @count = total
      @included_objs = included_objs
    end

    # The name of this ObjFacetValue, i.e. the value of the attribute.
    #
    # Example: If you do faceting using the attribute +color+,
    # you might receive an +ObjFacetValue+ with the name +"yellow"+,
    # another one with the name +"green"+ and so on.
    #
    # @return [String]
    # @api public
    attr_reader :name

    # Total number of Objs available that have this value.
    #
    # Note that this refers to all Objs, not just the Objs included in this search.
    # Also note that the count is approximate.
    #
    # @return [Integer]
    # @api public
    attr_reader :count

    # The Objs that were included in this search.
    #
    # If you did not specify +include_objs+ in your facet options,
    # an empty array is returned.
    # The Objs are ordered by relevance.
    #
    # @return [Array<BasicObj>]
    # @api public
    attr_reader :included_objs

  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
scrivito_sdk-1.12.0.rc2 app/cms/scrivito/obj_facet_value.rb
scrivito_sdk-1.12.0.rc1 app/cms/scrivito/obj_facet_value.rb