Module: Blacklight::Solr::Document
- Extended by:
- ActiveSupport::Concern
- Includes:
- Document, Document::ActiveModelShim
- Included in:
- SolrDocument
- Defined in:
- lib/blacklight/solr/document.rb
Overview
Introduction
Blacklight::Solr::Document is the module with logic for a class representing an individual document returned from Solr results. It can be added in to any local class you want, but in default Blacklight a SolrDocument class is provided for you which is pretty much a blank class “include”ing Blacklight::Solr::Document.
Blacklight::Solr::Document provides some DefaultFinders.
It also provides support for Document Extensions, which advertise supported transformation formats.
Constant Summary
Constants included from Document
Instance Attribute Summary
Attributes included from Document
Instance Method Summary collapse
Methods included from Document::ActiveModelShim
#==, #_read_attribute, #destroyed?, #id, #marked_for_destruction?, #new_record?, #persisted?, #to_partial_path
Methods included from Document
#fetch, #first, #has?, #initialize, #inspect, #to_partial_path
Methods included from Document::Export
#export_as, #export_formats, #exports_as?, #will_export_as
Methods included from Document::CacheKey
#cache_key, #cache_version_key
Methods included from Document::SemanticFields
Methods included from Document::SchemaOrg
Instance Method Details
#has_highlight_field?(k) ⇒ Boolean
27 28 29 30 31 |
# File 'lib/blacklight/solr/document.rb', line 27 def has_highlight_field? k return false if response['highlighting'].blank? || response['highlighting'][id].blank? response['highlighting'][id].key? k.to_s end |
#highlight_field(k) ⇒ Object
33 34 35 |
# File 'lib/blacklight/solr/document.rb', line 33 def highlight_field k response['highlighting'][id][k.to_s].map(&:html_safe) if has_highlight_field? k end |
#more_like_this ⇒ Object
23 24 25 |
# File 'lib/blacklight/solr/document.rb', line 23 def more_like_this response.more_like(self).map { |doc| self.class.new(doc, response) } end |