Class: Rafflesia::CombinedSearchHit
- Inherits:
-
Types::BaseModel
- Object
- Types::BaseModel
- Rafflesia::CombinedSearchHit
- Defined in:
- lib/rafflesia/search/combined_search_hit.rb
Constant Summary collapse
- HASH_ATTRS =
{ domain: :domain, position: :position, record_id: :record_id, score: :score, score_kind: :score_kind, sources: :sources }.freeze
Instance Attribute Summary collapse
-
#domain ⇒ Object
Returns the value of attribute domain.
-
#position ⇒ Object
Returns the value of attribute position.
-
#record_id ⇒ Object
Returns the value of attribute record_id.
-
#score ⇒ Object
Returns the value of attribute score.
-
#score_kind ⇒ Object
Returns the value of attribute score_kind.
-
#sources ⇒ Object
Returns the value of attribute sources.
Instance Method Summary collapse
-
#initialize(json) ⇒ CombinedSearchHit
constructor
A new instance of CombinedSearchHit.
Constructor Details
#initialize(json) ⇒ CombinedSearchHit
Returns a new instance of CombinedSearchHit.
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rafflesia/search/combined_search_hit.rb', line 25 def initialize(json) super() hash = self.class.normalize(json) @domain = hash[:domain] @position = hash[:position] @record_id = hash[:record_id] @score = hash[:score] @score_kind = hash[:score_kind] @sources = (hash[:sources] || []).map { |item| item ? Rafflesia::CombinedSearchHitSource.new(item) : nil } end |
Instance Attribute Details
#domain ⇒ Object
Returns the value of attribute domain.
17 18 19 |
# File 'lib/rafflesia/search/combined_search_hit.rb', line 17 def domain @domain end |
#position ⇒ Object
Returns the value of attribute position.
17 18 19 |
# File 'lib/rafflesia/search/combined_search_hit.rb', line 17 def position @position end |
#record_id ⇒ Object
Returns the value of attribute record_id.
17 18 19 |
# File 'lib/rafflesia/search/combined_search_hit.rb', line 17 def record_id @record_id end |
#score ⇒ Object
Returns the value of attribute score.
17 18 19 |
# File 'lib/rafflesia/search/combined_search_hit.rb', line 17 def score @score end |
#score_kind ⇒ Object
Returns the value of attribute score_kind.
17 18 19 |
# File 'lib/rafflesia/search/combined_search_hit.rb', line 17 def score_kind @score_kind end |
#sources ⇒ Object
Returns the value of attribute sources.
17 18 19 |
# File 'lib/rafflesia/search/combined_search_hit.rb', line 17 def sources @sources end |