class SolrLite::Highlights
Public Class Methods
from_response(solr_response)
click to toggle source
solr_response (string) is the Solr
HTTP response from a query
# File lib/highlights.rb, line 10 def self.from_response(solr_response) hash = JSON.parse(solr_response) Highlights.new(hash) end
new(solr_reponse_hash)
click to toggle source
solr_response_hash a Solr
HTTP response parsed via JSON.parse()
# File lib/highlights.rb, line 5 def initialize(solr_reponse_hash) @highlighting = solr_reponse_hash.fetch("highlighting", {}) end
Public Instance Methods
for(id)
click to toggle source
Returns the highlight information for the given document ID.
# File lib/highlights.rb, line 16 def for(id) return nil if @highlighting[id] == nil @highlighting[id] end