Sha256: 5a201e6e2b6e716357a300f66cfae5ea31b0003e61f93abdbcc6f8249ffc467e
Contents?: true
Size: 815 Bytes
Versions: 3
Compression:
Stored size: 815 Bytes
Contents
module Sunspot module Search class FieldJsonFacet attr_reader :name def initialize(field, search, options) @name, @search, @options = name, search, options @field = field end def rows @rows ||= begin json_facet_response = @search.json_facet_response[@field.name.to_s] data = json_facet_response.nil? ? [] : json_facet_response['buckets'] rows = [] data.each do |d| rows << JsonFacetRow.new(d, self) end if @options[:sort] == :count rows.sort! { |lrow, rrow| rrow.count <=> lrow.count } else rows.sort! { |lrow, rrow| lrow.value <=> rrow.value } end rows end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sunspot-2.5.0 | lib/sunspot/search/field_json_facet.rb |
sunspot-2.4.0 | lib/sunspot/search/field_json_facet.rb |
sunspot-2.3.0 | lib/sunspot/search/field_json_facet.rb |