Class: Typesensual::Search::GroupedHit

Inherits:
Object
  • Object
show all
Defined in:
lib/typesensual/search/grouped_hit.rb

Instance Method Summary collapse

Constructor Details

#initialize(group) ⇒ GroupedHit

{ "group_key": [ "420", "69" ], "hits": { ... }, "found": 3 }

Parameters:

  • group (Hash)

    the Typesense hit hash

    • group_key [Array] the grouping keys
    • hits [Hash] the Hits for the group
    • found [Integer] the number of hits in the group


20
21
22
# File 'lib/typesensual/search/grouped_hit.rb', line 20

def initialize(group)
  @group = group
end

Instance Method Details

#countObject



24
25
26
# File 'lib/typesensual/search/grouped_hit.rb', line 24

def count
  @group['found']
end

#group_keyObject



32
33
34
# File 'lib/typesensual/search/grouped_hit.rb', line 32

def group_key
  @group['group_key']
end

#hitsObject



28
29
30
# File 'lib/typesensual/search/grouped_hit.rb', line 28

def hits
  @group['hits'].map { |hit| Hit.new(hit) }
end