Sha256: f9ebeba78835b9a8fdc0880a3dfafc486472a6bcdd69e8ee8e596128300838f3
Contents?: true
Size: 928 Bytes
Versions: 2
Compression:
Stored size: 928 Bytes
Contents
module BlacklightHighlight module SolrDocumentExtension def self.included some_class some_class.after_initialize do solr_response.send(:extend, RSolr::Ext::Response::Highlight) unless solr_response.is_a? RSolr::Ext::Response::Highlight end end def [] key return super(key) if key == self.class.unique_key return highlight(key) if highlight_fields.key?(key) and not highlight(key).blank? super(key) end def key? key return super(key) if key == self.class.unique_key return true if highlight_fields.key?(key) super(key) end def highlight key = nil return if key == self.class.unique_key highlight_fields[key] end def highlight_fields @highlight_fields ||= begin return {} unless solr_response and solr_response.respond_to? :highlight solr_response.highlight(self) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
blacklight_highlight-0.0.2 | lib/blacklight_highlight/solr_document_extension.rb |
blacklight_highlight-0.0.1 | lib/blacklight_highlight/solr_document_extension.rb |