elastic_record 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: da221f93d4c557456f18f0b3892a5d2552caf4d2
4
- data.tar.gz: ee3abb0b5a4c3d22a58f7eba64f7a621af29e973
3
+ metadata.gz: c7b8f5fc3d3234cd4df693c95e621d6cdb7f8dad
4
+ data.tar.gz: ddb1266846f803009ee3ae703e55e88f31427f2a
5
5
  SHA512:
6
- metadata.gz: 3f02b3fee7e8464da19f7a8dac186572eae381d1cfc042022671ab369487ecfba68d988b8c035d5cf860775469f41a52d3d5c78016267df47fa9ef885929ccea
7
- data.tar.gz: f3afe2ea723942ef860a61fafcfb0d99680865e55117b59a2124109f2b1dd73bf55e17a3c783f7be30c63c03faea6eebe1e16f12fadbe8068a29f2bcd116869d
6
+ metadata.gz: 007cf7521d482d9d2905fb425e1407c82ac7a72b53ce456c60dfa24ff0b6714def89003a42bf90aee417047183937f94e1373eb605137e400dd8c06df6d57b78
7
+ data.tar.gz: 936d22b8288094f09be05009aabfaef241105c4b84df7ac6f237a228eb366e206d80307dc4896d43e5d0772744c4d8ab9889e5cabc58de9e5ee2f8851dcb566d
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'elastic_record'
5
- s.version = '1.0.0'
5
+ s.version = '1.0.1'
6
6
  s.summary = 'Use Elastic Search with your objects'
7
7
  s.description = 'Find your records with elastic search'
8
8
 
@@ -14,11 +14,14 @@ module ElasticRecord
14
14
  end
15
15
 
16
16
  def find_ids_in_batches(options = {})
17
- scroll_keep_alive = '10m'
17
+ options.assert_valid_keys(:batch_size)
18
+
19
+ scroll_keep_alive = '1m'
20
+ size = options[:batch_size] || 100
18
21
 
19
22
  options = {
20
23
  scroll: scroll_keep_alive,
21
- size: 100,
24
+ size: size,
22
25
  search_type: 'scan'
23
26
  }.update(options)
24
27
 
@@ -14,14 +14,24 @@ class ElasticRecord::Relation::BatchesTest < MiniTest::Spec
14
14
  assert_equal ['5', '10', '15'].to_set, results.to_set
15
15
  end
16
16
 
17
- def test_ids_in_batches
17
+ def test_find_ids_in_batches
18
18
  results = []
19
- Widget.elastic_relation.find_ids_in_batches do |widgets|
20
- results << widgets
19
+ Widget.elastic_relation.find_ids_in_batches do |ids|
20
+ results << ids
21
21
  end
22
22
  assert_equal [['5', '10', '15'].to_set], results.map(&:to_set)
23
23
  end
24
24
 
25
+ def test_find_ids_in_batches_with_size
26
+ results = []
27
+ Widget.elastic_relation.find_ids_in_batches(batch_size: 1) do |ids|
28
+ results << ids
29
+ end
30
+
31
+ assert_equal 2, results.size
32
+ assert_equal ['5', '10', '15'].to_set, results.flatten.to_set
33
+ end
34
+
25
35
  def test_find_in_batches
26
36
  results = []
27
37
  Widget.elastic_relation.find_in_batches do |widgets|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastic_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Infogroup
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-11 00:00:00.000000000 Z
12
+ date: 2013-05-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: arelastic