scalastic 0.8.2 → 0.8.3

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: d9c85a4c8ce641aeb06c69d512a7a89bf5f7f17b
4
- data.tar.gz: fa1fceadf8d9e1e149e5d20b64e94a31b43364de
3
+ metadata.gz: ee62608cd0f7a9e28cf377d8ccc9b46dca5bbb6e
4
+ data.tar.gz: 9e57722efd8725a62eea09ca68f746e7173c9fe7
5
5
  SHA512:
6
- metadata.gz: 504345904505bdf7b63732a8ebc48caf1f535911fc9620510f67f066ac47c772f780d23d8288bcc4ae430610404e195fc01468fa46b54009887c40ccee53c34f
7
- data.tar.gz: e3eea7ac3814e88f7889a64a65f1e3fb9570b81db57ebc85c67dc0bab72a1810bf3ee93a5bf086adcb59726e59f370dd3715f9eed7357973492c34da427fc50b
6
+ metadata.gz: 82d1cc08d8f7e4349956f60acdef9b3541db0a3e3efbada1bff9609495e55a5fcd788d83970346bd811e955809a6e06e90ba344ee2f7ca1c5a4596274075e63e
7
+ data.tar.gz: 1e348dcebe37380687a7522297831c6f0c622a4566e6ea1b34789a31a31f82bb9435da9eb62e1d893d612b466331eec5dba6dc21886573a8241c237093685d01
@@ -7,11 +7,17 @@ module Scalastic
7
7
  normalize_internal(hash)
8
8
  end
9
9
 
10
+ def safe_get(hash, *keys)
11
+ keys.reduce(hash) do |h, k|
12
+ h && (h[k.to_s] || h[k.to_sym])
13
+ end
14
+ end
15
+
10
16
  private
11
17
 
12
18
  def normalize_internal(object)
13
19
  if (object.is_a?(Hash))
14
- object.map{|k, v| [k.to_s, normalize_internal(v)]}.to_h
20
+ Hash[object.map{|k, v| [k.to_s, normalize_internal(v)]}]
15
21
  elsif object.respond_to?(:map)
16
22
  object.map{|i| normalize_internal(i)}
17
23
  else
@@ -21,11 +21,11 @@ module Scalastic
21
21
  def each(&block)
22
22
  Enumerator.new do |enum|
23
23
  args = @args.merge(search_type: 'scan', scroll: scroll)
24
- res = normalized(@es_client.search(args))
24
+ res = @es_client.search(args)
25
25
  loop do
26
- scroll_id = res['_scroll_id']
27
- res = normalized(@es_client.scroll(body: scroll_id, scroll: scroll))
28
- hits = res['hits']['hits']
26
+ scroll_id = safe_get(res, '_scroll_id')
27
+ res = @es_client.scroll(body: scroll_id, scroll: scroll)
28
+ hits = safe_get(res, 'hits', 'hits')
29
29
  break unless hits.any?
30
30
  hits.each{|h| enum << h}
31
31
  end
@@ -1,3 +1,3 @@
1
1
  module Scalastic
2
- VERSION = "0.8.2"
2
+ VERSION = "0.8.3"
3
3
  end
metadata CHANGED
@@ -1,105 +1,105 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scalastic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aliaksei Baturytski
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-20 00:00:00.000000000 Z
11
+ date: 2016-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
- requirement: !ruby/object:Gem::Requirement
15
+ version_requirements: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.10'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
20
+ requirement: !ruby/object:Gem::Requirement
23
21
  requirements:
24
- - - "~>"
22
+ - - ~>
25
23
  - !ruby/object:Gem::Version
26
24
  version: '1.10'
25
+ prerelease: false
26
+ type: :development
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
- requirement: !ruby/object:Gem::Requirement
29
+ version_requirements: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
34
+ requirement: !ruby/object:Gem::Requirement
37
35
  requirements:
38
- - - "~>"
36
+ - - ~>
39
37
  - !ruby/object:Gem::Version
40
38
  version: '10.0'
39
+ prerelease: false
40
+ type: :development
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
- requirement: !ruby/object:Gem::Requirement
43
+ version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: '3.4'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
51
49
  requirements:
52
- - - "~>"
50
+ - - ~>
53
51
  - !ruby/object:Gem::Version
54
52
  version: '3.4'
53
+ prerelease: false
54
+ type: :development
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: simplecov
57
- requirement: !ruby/object:Gem::Requirement
57
+ version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0.11'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
62
+ requirement: !ruby/object:Gem::Requirement
65
63
  requirements:
66
- - - "~>"
64
+ - - ~>
67
65
  - !ruby/object:Gem::Version
68
66
  version: '0.11'
67
+ prerelease: false
68
+ type: :development
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: json
71
- requirement: !ruby/object:Gem::Requirement
71
+ version_requirements: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ~>
74
74
  - !ruby/object:Gem::Version
75
75
  version: '1.8'
76
- - - ">="
76
+ - - '>='
77
77
  - !ruby/object:Gem::Version
78
78
  version: 1.8.3
79
- type: :runtime
80
- prerelease: false
81
- version_requirements: !ruby/object:Gem::Requirement
79
+ requirement: !ruby/object:Gem::Requirement
82
80
  requirements:
83
- - - "~>"
81
+ - - ~>
84
82
  - !ruby/object:Gem::Version
85
83
  version: '1.8'
86
- - - ">="
84
+ - - '>='
87
85
  - !ruby/object:Gem::Version
88
86
  version: 1.8.3
87
+ prerelease: false
88
+ type: :runtime
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: elasticsearch
91
- requirement: !ruby/object:Gem::Requirement
91
+ version_requirements: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - "~>"
93
+ - - ~>
94
94
  - !ruby/object:Gem::Version
95
95
  version: '1.0'
96
- type: :runtime
97
- prerelease: false
98
- version_requirements: !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
99
97
  requirements:
100
- - - "~>"
98
+ - - ~>
101
99
  - !ruby/object:Gem::Version
102
100
  version: '1.0'
101
+ prerelease: false
102
+ type: :runtime
103
103
  description: Elasticsearch alias-based partitions for scalable indexing and searching
104
104
  email:
105
105
  - abaturytski@gmail.com
@@ -107,8 +107,8 @@ executables: []
107
107
  extensions: []
108
108
  extra_rdoc_files: []
109
109
  files:
110
- - ".gitignore"
111
- - ".travis.yml"
110
+ - .gitignore
111
+ - .travis.yml
112
112
  - Gemfile
113
113
  - LICENSE.txt
114
114
  - README.md
@@ -149,24 +149,24 @@ homepage: https://github.com/aliakb/scalastic
149
149
  licenses:
150
150
  - MIT
151
151
  metadata: {}
152
- post_install_message:
152
+ post_install_message:
153
153
  rdoc_options: []
154
154
  require_paths:
155
155
  - lib
156
156
  required_ruby_version: !ruby/object:Gem::Requirement
157
157
  requirements:
158
- - - ">="
158
+ - - '>='
159
159
  - !ruby/object:Gem::Version
160
160
  version: '1.9'
161
161
  required_rubygems_version: !ruby/object:Gem::Requirement
162
162
  requirements:
163
- - - ">="
163
+ - - '>='
164
164
  - !ruby/object:Gem::Version
165
165
  version: '0'
166
166
  requirements: []
167
- rubyforge_project:
168
- rubygems_version: 2.5.1
169
- signing_key:
167
+ rubyforge_project:
168
+ rubygems_version: 2.4.5
169
+ signing_key:
170
170
  specification_version: 4
171
171
  summary: Elasticsearch document partitions
172
172
  test_files: []