Module: Elastic::Shims::Concerns::HitPicker

Included in:
FieldPicking, IdPicking
Defined in:
lib/elastic/shims/concerns/hit_picker.rb

Instance Method Summary collapse

Instance Method Details

#handle_result(_raw, _formatter) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/elastic/shims/concerns/hit_picker.rb', line 8

def handle_result(_raw, _formatter)
  result = super

  case result
  when Elastic::Results::Root
    transform_collection(result)
  when Elastic::Results::GroupedResult
    result.map_to_group { |c| transform_collection(c) }
  else
    raise "unable to pick from result of type #{result.class}"
  end
end

#render(_options = {}) ⇒ Object



3
4
5
6
# File 'lib/elastic/shims/concerns/hit_picker.rb', line 3

def render(_options = {})
  set_hits_source unless required_source_fields.nil?
  super
end