Class: RailsConnector::SES::Hit
- Inherits:
-
Object
- Object
- RailsConnector::SES::Hit
- Defined in:
- lib/rails_connector/ses.rb
Overview
A hit represents a found document for a particular search query.
Instance Attribute Summary collapse
-
#doc ⇒ Object
readonly
The ID of the found Obj.
-
#id ⇒ Object
readonly
The ID of the found Obj.
-
#score ⇒ Object
readonly
The ID of the found Obj.
Instance Method Summary collapse
-
#initialize(id, score, doc = {}, obj = nil) ⇒ Hit
constructor
The raw result hash returned by the search engine, for a low-level access.
-
#obj ⇒ Object
Returns the hit’s corresponding Obj (or nil if none found in the database).
Constructor Details
#initialize(id, score, doc = {}, obj = nil) ⇒ Hit
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 65 66 67 |
# File 'lib/rails_connector/ses.rb', line 62 def initialize(id, score, doc = {}, obj = nil) @id = id @score = score @doc = doc @obj = obj end |
Instance Attribute Details
#doc ⇒ Object (readonly)
The ID of the found Obj.
52 53 54 |
# File 'lib/rails_connector/ses.rb', line 52 def doc @doc end |
#id ⇒ Object (readonly)
The ID of the found Obj.
52 53 54 |
# File 'lib/rails_connector/ses.rb', line 52 def id @id end |
#score ⇒ Object (readonly)
The ID of the found Obj.
52 53 54 |
# File 'lib/rails_connector/ses.rb', line 52 def score @score end |
Instance Method Details
#obj ⇒ Object
Returns the hit’s corresponding Obj (or nil if none found in the database).
71 72 73 74 75 |
# File 'lib/rails_connector/ses.rb', line 71 def obj @obj ||= ::Obj.find(@id) rescue RailsConnector::ResourceNotFound nil end |