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:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: c7b8f5fc3d3234cd4df693c95e621d6cdb7f8dad
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: ddb1266846f803009ee3ae703e55e88f31427f2a
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 007cf7521d482d9d2905fb425e1407c82ac7a72b53ce456c60dfa24ff0b6714def89003a42bf90aee417047183937f94e1373eb605137e400dd8c06df6d57b78
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 936d22b8288094f09be05009aabfaef241105c4b84df7ac6f237a228eb366e206d80307dc4896d43e5d0772744c4d8ab9889e5cabc58de9e5ee2f8851dcb566d
         
     | 
    
        data/elastic_record.gemspec
    CHANGED
    
    
| 
         @@ -14,11 +14,14 @@ module ElasticRecord 
     | 
|
| 
       14 
14 
     | 
    
         
             
                  end
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
                  def find_ids_in_batches(options = {})
         
     | 
| 
       17 
     | 
    
         
            -
                     
     | 
| 
      
 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:  
     | 
| 
      
 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  
     | 
| 
      
 17 
     | 
    
         
            +
              def test_find_ids_in_batches
         
     | 
| 
       18 
18 
     | 
    
         
             
                results = []
         
     | 
| 
       19 
     | 
    
         
            -
                Widget.elastic_relation.find_ids_in_batches do | 
     | 
| 
       20 
     | 
    
         
            -
                  results <<  
     | 
| 
      
 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. 
     | 
| 
      
 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- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2013-05-15 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: arelastic
         
     |