Class: Maglev::SearchResult
- Inherits:
-
Object
- Object
- Maglev::SearchResult
- Defined in:
- lib/maglev/search_result.rb
Instance Attribute Summary collapse
-
#chunk_index ⇒ Object
readonly
Returns the value of attribute chunk_index.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#distance ⇒ Object
readonly
Returns the value of attribute distance.
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
-
#initialize(owner:, content:, source:, distance:, chunk_index: nil) ⇒ SearchResult
constructor
A new instance of SearchResult.
- #similarity ⇒ Object
Constructor Details
#initialize(owner:, content:, source:, distance:, chunk_index: nil) ⇒ SearchResult
Returns a new instance of SearchResult.
7 8 9 10 11 12 13 14 |
# File 'lib/maglev/search_result.rb', line 7 def initialize(owner:, content:, source:, distance:, chunk_index: nil) @owner = owner @content = content @source = source @distance = distance @chunk_index = chunk_index freeze end |
Instance Attribute Details
#chunk_index ⇒ Object (readonly)
Returns the value of attribute chunk_index.
5 6 7 |
# File 'lib/maglev/search_result.rb', line 5 def chunk_index @chunk_index end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
5 6 7 |
# File 'lib/maglev/search_result.rb', line 5 def content @content end |
#distance ⇒ Object (readonly)
Returns the value of attribute distance.
5 6 7 |
# File 'lib/maglev/search_result.rb', line 5 def distance @distance end |
#owner ⇒ Object (readonly)
Returns the value of attribute owner.
5 6 7 |
# File 'lib/maglev/search_result.rb', line 5 def owner @owner end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
5 6 7 |
# File 'lib/maglev/search_result.rb', line 5 def source @source end |
Instance Method Details
#similarity ⇒ Object
16 17 18 19 20 |
# File 'lib/maglev/search_result.rb', line 16 def similarity return nil if distance.nil? 1.0 - distance.to_f end |