Sha256: 82731424437e6dd9854dadb43261f24c8df67c22cf24e1ab78dfab8a78eda9d6

Contents?: true

Size: 1.12 KB

Versions: 12

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true
require 'rsolr'
##
##
# = 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.
#

module Blacklight::Solr::Document
  autoload :MoreLikeThis, 'blacklight/solr/document/more_like_this'

  extend ActiveSupport::Concern
  include Blacklight::Document
  include Blacklight::Document::ActiveModelShim
  include Blacklight::Solr::Document::MoreLikeThis

  def has_highlight_field? k
    return false if response['highlighting'].blank? or response['highlighting'][self.id].blank?
    
    response['highlighting'][self.id].key? k.to_s
  end

  def highlight_field k
    response['highlighting'][self.id][k.to_s].map(&:html_safe) if has_highlight_field? k
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
blacklight-6.5.0 app/models/concerns/blacklight/solr/document.rb
blacklight-6.4.2 app/models/concerns/blacklight/solr/document.rb
blacklight-6.4.1 app/models/concerns/blacklight/solr/document.rb
blacklight-6.4.0 app/models/concerns/blacklight/solr/document.rb
blacklight-6.3.3 app/models/concerns/blacklight/solr/document.rb
blacklight-6.3.1 app/models/concerns/blacklight/solr/document.rb
blacklight-6.3.0 app/models/concerns/blacklight/solr/document.rb
blacklight-6.2.0 app/models/concerns/blacklight/solr/document.rb
blacklight-6.1.0 app/models/concerns/blacklight/solr/document.rb
blacklight-6.0.2 app/models/concerns/blacklight/solr/document.rb
blacklight-6.0.1 app/models/concerns/blacklight/solr/document.rb
blacklight-6.0.0 app/models/concerns/blacklight/solr/document.rb