Class: RailsConnector::SES::Hit

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_connector/ses.rb

Overview

A hit represents a found document for a particular search query.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#docObject (readonly)

The raw result hash returned by the search engine, for a low-level access. Don’t use this unless you know what you’re doing. Be aware that this is not migration safe.



62
63
64
# File 'lib/rails_connector/ses.rb', line 62

def doc
  @doc
end

#idObject (readonly)

The ID of the found Obj.



52
53
54
# File 'lib/rails_connector/ses.rb', line 52

def id
  @id
end

#scoreObject (readonly)

The score of the hit.



56
57
58
# File 'lib/rails_connector/ses.rb', line 56

def score
  @score
end

Instance Method Details

#objObject

Returns the hit’s corresponding Obj (or nil if none found in the database).



73
74
75
76
77
# File 'lib/rails_connector/ses.rb', line 73

def obj
  @obj ||= ::Obj.find(@id)
rescue RailsConnector::ResourceNotFound
  nil
end