Sha256: f751109659fde0ed4b779790b642014205f90b577fb35e211d596ccfbd4cdc97

Contents?: true

Size: 1.09 KB

Versions: 12

Compression:

Stored size: 1.09 KB

Contents

# -*- encoding : utf-8 -*-
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
  extend ActiveSupport::Concern
  include Blacklight::Document
  require_relative 'document/more_like_this'

  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-5.19.2 app/models/concerns/blacklight/solr/document.rb
blacklight-5.19.1 app/models/concerns/blacklight/solr/document.rb
blacklight-5.19.0 app/models/concerns/blacklight/solr/document.rb
blacklight-5.18.0 app/models/concerns/blacklight/solr/document.rb
blacklight-5.17.2 app/models/concerns/blacklight/solr/document.rb
blacklight-5.17.1 app/models/concerns/blacklight/solr/document.rb
blacklight-5.17.0 app/models/concerns/blacklight/solr/document.rb
blacklight-5.16.4 app/models/concerns/blacklight/solr/document.rb
blacklight-5.16.3 app/models/concerns/blacklight/solr/document.rb
blacklight-5.16.2 app/models/concerns/blacklight/solr/document.rb
blacklight-5.16.1 app/models/concerns/blacklight/solr/document.rb
blacklight-5.16.0 app/models/concerns/blacklight/solr/document.rb