Module: RSolr::Ext::Response::Highlight

Defined in:
lib/rsolr-ext/response/highlight.rb

Instance Method Summary collapse

Instance Method Details

#highlight(document, field = nil) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/rsolr-ext/response/highlight.rb', line 5

def highlight document, field = nil
  doc_highlights = highlights[document.id]
  doc_highlights ||= {}

  return doc_highlights[field] if field

  doc_highlights
end

#highlightsObject



14
15
16
17
18
# File 'lib/rsolr-ext/response/highlight.rb', line 14

def highlights 
  return {} unless self[:highlighting] 
    
  @highlights ||= self[:highlighting]
end