Method: Sunspot::Search::Hit#stored
- Defined in:
- lib/sunspot/search/hit.rb
#stored(field_name, dynamic_field_name = nil) ⇒ Object
Retrieve stored field value. For any attribute field configured with :stored => true, the Hit object will contain the stored value for that field. The value of this field will be typecast according to the type of the field.
Parameters
- field_name<Symbol>
-
The name of the field for which to retrieve the stored value.
- dynamic_field_name<Symbol>
-
If you want to access a stored dynamic field, this should be the dynamic component of the field name.
72 73 74 75 76 77 78 79 80 81 |
# File 'lib/sunspot/search/hit.rb', line 72 def stored(field_name, dynamic_field_name = nil) field_key = if dynamic_field_name [field_name.to_sym, dynamic_field_name.to_sym] else field_name.to_sym end return @stored_cache[field_key] if @stored_cache.has_key?(field_key) @stored_cache[field_key] = stored_value(field_name, dynamic_field_name) end |