module Blacklight::Solr::Document

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.

Public Instance Methods

has_highlight_field?(k) click to toggle source
# File lib/blacklight/solr/document.rb, line 26
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) click to toggle source
# File lib/blacklight/solr/document.rb, line 32
def highlight_field k
  response['highlighting'][id][k.to_s].map(&:html_safe) if has_highlight_field? k
end
more_like_this() click to toggle source
# File lib/blacklight/solr/document.rb, line 22
def more_like_this
  response.more_like(self).map { |doc| self.class.new(doc, response) }
end