Method: Sunspot::Search::Hit#highlights
- Defined in:
- lib/sunspot/search/hit.rb
#highlights(field_name = nil) ⇒ Object
Returns all highlights for this hit when called without parameters. When a field_name is provided, returns only the highlight for this field.
42 43 44 45 46 47 48 |
# File 'lib/sunspot/search/hit.rb', line 42 def highlights(field_name = nil) if field_name.nil? highlights_cache.values.flatten else highlights_cache[field_name.to_sym] end || [] end |