elastic_adapter 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3023280225ea7fdf0075512820f96c192d448e33
4
- data.tar.gz: f492fc71afbd84718f09dc7fb2a176f9adee2de0
3
+ metadata.gz: 8e39324dd02ae383ab7d86347961777c2509b7e2
4
+ data.tar.gz: 99fbe0dad75178310acb85a33b6f7cb85c6743fa
5
5
  SHA512:
6
- metadata.gz: 35fa163b104cb2965f2559ae8ea97a0438ededd741e339d7d9e163e0839360eef9004df5bd1140f93b5f487040a2f5a73ce498f43234efe80bfd03f82c7478d2
7
- data.tar.gz: e5e2cf3126f2b0e58d98163d6716db4cec4da8f019c01606cfa975cd018b8f0dc89665fd4d02aba5efeaa4726194d6303a569f20630505edb28af06e94493ca1
6
+ metadata.gz: cab2028e5051ea85cb5dbacd42867df674cd254b27f663de1691c0654cd56c468f90d1f7f40640bae4887b7e86d40d5394af7cea2b1743790d2c399099de95bc
7
+ data.tar.gz: 831382d5af0b6c00f678512dd5e939f231630ef7ad7f328b09add3b31c544122dd1fd17473817f9a608e1b376e2fb405b89488decb11c71071a6d02c32b34432
@@ -12,10 +12,12 @@ module ElasticAdapter
12
12
  end
13
13
 
14
14
  def collect_hits
15
+ return [] unless object[:hits]
15
16
  object[:hits][:hits].map { |hit| { id: hit[:id] }.merge(hit[:source]) }
16
17
  end
17
18
 
18
19
  def collect_aggregations
20
+ return [] unless object[:aggregations]
19
21
  aggs = {}
20
22
  object[:aggregations].each do |agg_name, result|
21
23
  aggs[agg_name] = []
@@ -27,6 +29,7 @@ module ElasticAdapter
27
29
  end
28
30
 
29
31
  def collect_suggestions
32
+ return [] unless object[:suggest]
30
33
  object[:suggest].map { |suggestion_name, content|
31
34
  # In this context key is the named suggestion
32
35
  # returned by elasticsearch
@@ -1,3 +1,3 @@
1
1
  module ElasticAdapter
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -58,6 +58,14 @@ module ElasticAdapter
58
58
 
59
59
  subject { SearchResponse.new(response) }
60
60
 
61
+ context "empty response" do
62
+ let(:response) {{}}
63
+
64
+ it "should not fail" do
65
+ expect { subject }.not_to raise_error
66
+ end
67
+ end
68
+
61
69
  describe "hits" do
62
70
  it "returns the hits" do
63
71
  expect(subject.hits).to include({
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastic_adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kristopher Bredemeier