elastic_adapter 0.0.7 → 0.0.8

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: 8e39324dd02ae383ab7d86347961777c2509b7e2
4
- data.tar.gz: 99fbe0dad75178310acb85a33b6f7cb85c6743fa
3
+ metadata.gz: 41bc711f93edbf4976d4dad92a787e08b86063c1
4
+ data.tar.gz: f33c72a1b44eae20a56d15c9ec580a8581d1b22b
5
5
  SHA512:
6
- metadata.gz: cab2028e5051ea85cb5dbacd42867df674cd254b27f663de1691c0654cd56c468f90d1f7f40640bae4887b7e86d40d5394af7cea2b1743790d2c399099de95bc
7
- data.tar.gz: 831382d5af0b6c00f678512dd5e939f231630ef7ad7f328b09add3b31c544122dd1fd17473817f9a608e1b376e2fb405b89488decb11c71071a6d02c32b34432
6
+ metadata.gz: 60f618f24a7967f57b2e04249dc798d7f89dd7de69fb6fd7ecd051e4c7ca3ce5455b6fa9c9f9c541188818245bf272b05895386c67f895ea5342f954b6097f82
7
+ data.tar.gz: 0036875c1887e806c9455f808e34a58c0372cb67729d589c5373f4be25f9d02490c5821f34637df9a196e6762cf60296adb622d71e78227811b95a27f2375f90
@@ -17,15 +17,7 @@ module ElasticAdapter
17
17
  end
18
18
 
19
19
  def collect_aggregations
20
- return [] unless object[:aggregations]
21
- aggs = {}
22
- object[:aggregations].each do |agg_name, result|
23
- aggs[agg_name] = []
24
- result[:buckets].each do |agg|
25
- aggs[agg_name] << { term: agg[:key], count: agg[:doc_count] }
26
- end
27
- end
28
- aggs
20
+ object.fetch(:aggregations, [])
29
21
  end
30
22
 
31
23
  def collect_suggestions
@@ -1,3 +1,3 @@
1
1
  module ElasticAdapter
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -78,32 +78,8 @@ module ElasticAdapter
78
78
  end
79
79
 
80
80
  describe "#aggregations" do
81
- it "counts one" do
82
- expect(subject.aggregations.count).to eq 1
83
- end
84
-
85
- it "contains products" do
86
- expect(subject.aggregations).to have_key :products
87
- end
88
-
89
- describe "products" do
90
- it "counts two" do
91
- expect(subject.aggregations[:products].count).to eq 2
92
- end
93
-
94
- it "contains Product A with it's count" do
95
- expect(subject.aggregations[:products]).to include({
96
- term: "Product A",
97
- count: 100
98
- })
99
- end
100
-
101
- it "contains Product Z with it's count" do
102
- expect(subject.aggregations[:products]).to include({
103
- term: "Product Z",
104
- count: 52
105
- })
106
- end
81
+ it "returns the aggregations" do
82
+ expect(subject.aggregations).to eq response[:aggregations]
107
83
  end
108
84
  end
109
85
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastic_adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kristopher Bredemeier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-09 00:00:00.000000000 Z
11
+ date: 2015-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: elasticsearch