Skip to content

Commit

Permalink
Rename Blacklight::Document#solr_response to #response
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Feb 17, 2015
1 parent 39787f0 commit 97eac93
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions lib/blacklight/solr/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ module Blacklight::Solr::Document
include Blacklight::Solr::Document::Extensions
end

attr_reader :solr_response
attr_reader :response
alias_method :solr_response, :response

def initialize(source_doc={}, solr_response=nil)
def initialize(source_doc={}, response=nil)
@_source = source_doc.with_indifferent_access
@solr_response = solr_response
@response = response
apply_extensions
end

Expand Down Expand Up @@ -87,15 +88,14 @@ def key? k
end

def has_highlight_field? k
return false if @solr_response['highlighting'].blank? or @solr_response['highlighting'][self.id].blank?
return false if response['highlighting'].blank? or response['highlighting'][self.id].blank?

@solr_response['highlighting'][self.id].key? k.to_s
response['highlighting'][self.id].key? k.to_s
end

def highlight_field k
return nil unless has_highlight_field? k
@solr_response['highlighting'][self.id][k.to_s].map { |x| x.html_safe }

response['highlighting'][self.id][k.to_s].map { |x| x.html_safe }
end

# helper
Expand Down
2 changes: 1 addition & 1 deletion lib/blacklight/solr/document/more_like_this.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Blacklight::Solr::Document::MoreLikeThis
def more_like_this
solr_response.more_like(self).map { |doc| self.class.new(doc, solr_response) }
response.more_like(self).map { |doc| self.class.new(doc, response) }
end
end

0 comments on commit 97eac93

Please sign in to comment.