class SimpleSolrClient::Response::Document

Attributes

rank[RW]

!@attribute solr_doc_hash

@return [Hash] the original, un-munged solr data for this document passed into the initializer
solr_doc_hash[RW]

!@attribute solr_doc_hash

@return [Hash] the original, un-munged solr data for this document passed into the initializer

Public Class Methods

new(solrdochash) click to toggle source

Create a single document from a Hash representation of the solr return value @param solrdochash [Hash] The ruby-hash representation of a Solr document as returned by a solr query

# File lib/simple_solr_client/response/document.rb, line 25
def initialize(solrdochash)
  @solr_doc_hash = solrdochash
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/simple_solr_client/response/document.rb, line 7
def <=>(other)
  other = other.score if other.respond_to? :score,
                                           self.score <=> other
end
id() click to toggle source

The value of the 'id' field of this document

# File lib/simple_solr_client/response/document.rb, line 31
def id
  @solr_doc_hash['id']
end
score() click to toggle source

The score of this document on thsi query

# File lib/simple_solr_client/response/document.rb, line 36
def score
  @solr_doc_hash['score']
end
to_h() click to toggle source
# File lib/simple_solr_client/response/document.rb, line 41
def to_h
  @solr_doc_hash.merge({'_rank' => @rank})
end