Sha256: 41c2ac9be85cbf76fbb5450dc36270cfafbd380b988d77676f6e104463c17e9d

Contents?: true

Size: 561 Bytes

Versions: 6

Compression:

Stored size: 561 Bytes

Contents

module Sunspot
  module Search
    class JsonFacetStats
      def initialize(field, search, options)
        @field, @search, @options = field, search, options
      end

      def rows
        @rows ||=
          begin
            json_facet_response = @search.json_facet_response[@field.to_s]
            data = json_facet_response.nil? ? [] : json_facet_response['buckets']
            rows = []
            data.each do |d|
              rows << StatsJsonRow.new(d, nil, d['val'])
            end
            rows
          end

      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sunspot-2.7.1 lib/sunspot/search/json_facet_stats.rb
sunspot-2.7.0 lib/sunspot/search/json_facet_stats.rb
sunspot-2.6.0 lib/sunspot/search/json_facet_stats.rb
sunspot-2.5.0 lib/sunspot/search/json_facet_stats.rb
sunspot-2.4.0 lib/sunspot/search/json_facet_stats.rb
sunspot-2.3.0 lib/sunspot/search/json_facet_stats.rb