lib/thinking_sphinx/facet.rb in ebeigarts-thinking-sphinx-1.1.22 vs lib/thinking_sphinx/facet.rb in ebeigarts-thinking-sphinx-1.2.10

- old
+ new

@@ -70,11 +70,11 @@ def type @property.is_a?(Field) ? :string : @property.type end def value(object, attribute_value) - return translate(object, attribute_value) if translate? + return translate(object, attribute_value) if translate? || float? case @property.type when :datetime Time.at(attribute_value) when :boolean @@ -93,16 +93,22 @@ def translate(object, attribute_value) column.__stack.each { |method| return nil unless object = object.send(method) } if object.is_a?(Array) - object.collect { |item| item.send(column.__name) } + object.collect { |item| item.send(column.__name) }.detect { |item| + item.to_crc32 == attribute_value + } else object.send(column.__name) end end def column @property.columns.first + end + + def float? + @property.type == :float end end end