Class: Rafflesia::CombinedSearchHit

Inherits:
Types::BaseModel
  • Object
show all
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

Instance Method Summary collapse

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

#domainObject

Returns the value of attribute domain.



17
18
19
# File 'lib/rafflesia/search/combined_search_hit.rb', line 17

def domain
  @domain
end

#positionObject

Returns the value of attribute position.



17
18
19
# File 'lib/rafflesia/search/combined_search_hit.rb', line 17

def position
  @position
end

#record_idObject

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

#scoreObject

Returns the value of attribute score.



17
18
19
# File 'lib/rafflesia/search/combined_search_hit.rb', line 17

def score
  @score
end

#score_kindObject

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

#sourcesObject

Returns the value of attribute sources.



17
18
19
# File 'lib/rafflesia/search/combined_search_hit.rb', line 17

def sources
  @sources
end