Class: Sunspot::Type::FloatType

Inherits:
AbstractType show all
Defined in:
lib/sunspot/type.rb

Overview

The Float type represents floating-point numbers.

Direct Known Subclasses

DoubleType, TrieFloatType

Instance Method Summary collapse

Methods inherited from AbstractType

#accepts_dynamic?, #accepts_more_like_this?, instance

Instance Method Details

#cast(string) ⇒ Object

:nodoc:



178
179
180
# File 'lib/sunspot/type.rb', line 178

def cast(string) #:nodoc:
  string.to_f
end

#indexed_name(name) ⇒ Object

:nodoc:



166
167
168
# File 'lib/sunspot/type.rb', line 166

def indexed_name(name) #:nodoc:
  "#{name}_f"
end

#to_indexed(value) ⇒ Object

:nodoc:



170
171
172
# File 'lib/sunspot/type.rb', line 170

def to_indexed(value) #:nodoc:
  value.to_f.to_s if value
end

#to_literal(value) ⇒ Object



174
175
176
# File 'lib/sunspot/type.rb', line 174

def to_literal(value)
  to_indexed(value)
end