Method: Sunspot::Field#to_indexed
- Defined in:
- lib/sunspot/field.rb
#to_indexed(value) ⇒ Object
Convert a value to its representation for Solr indexing. This delegates to the #to_indexed method on the field’s type.
Parameters
- value<Object>
-
Value to convert to Solr representation
Returns
- String
-
Solr representation of the object
Raises
- ArgumentError
-
the value is an array, but this field does not allow multiple values
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/sunspot/field.rb', line 36 def to_indexed(value) if value.is_a? Array if multiple? value.map { |val| to_indexed(val) } else raise ArgumentError, "#{name} is not a multiple-value field, so it cannot index values #{value.inspect}" end else @type.to_indexed(value) end end |