Commit 68d4724
Merge #224
224: Added methods add_documents_in_batches, update_documents_in_batches and their tests r=curquiza a=FlamesRunner
This pull request adds the following methods:
- add_documents_in_batches(documents, batch_size = 1000, primary_key = nil)
- update_documents_in_batches(documents, batch_size = 1000, primary_key = nil)
The tests for these methods are:
- adds documents in a batch (as a array of documents)
- adds document batches synchronously (as an array of documents)
- updates documents in index in batches
- updates documents synchronously in index in batches (as an array of documents)
They are based on their non-batch methods. There are two linter errors:
```
lib/meilisearch/index.rb:7:3: C: Metrics/ClassLength: Class has too many lines. [252/226]
class Index < HTTPRequest ...
^^^^^^^^^^^^^^^^^^^^^^^^^
spec/meilisearch/index/documents_spec.rb:3:1: C: Metrics/BlockLength: Block has too many lines. [500/497]
RSpec.describe 'MeiliSearch::Index - Documents' do ...
```
The linter indicates that there are too many lines for `documents_spec.rb` (which I was thinking of correcting by adding a new documents_batch_spec.rb, or the less clean way of changing the linter, etc), and that `index.rb` has too many lines (this one I am less sure of, as there aren't really any other classes that separate methods and since this is my first PR here, I don't want to introduce anything that might break something). I'm unsure, so I'd like to get some feedback on these.
References issue #218.
Co-authored-by: Andrew Hong <[email protected]>
Co-authored-by: Andrew H <[email protected]>File tree
3 files changed
+112
-4
lines changed- lib/meilisearch
- spec/meilisearch/index
3 files changed
+112
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
79 | 113 | | |
80 | 114 | | |
81 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
38 | 49 | | |
39 | 50 | | |
40 | 51 | | |
| |||
45 | 56 | | |
46 | 57 | | |
47 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
48 | 72 | | |
49 | 73 | | |
50 | 74 | | |
| |||
109 | 133 | | |
110 | 134 | | |
111 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
112 | 161 | | |
113 | 162 | | |
114 | 163 | | |
| |||
131 | 180 | | |
132 | 181 | | |
133 | 182 | | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
134 | 208 | | |
135 | 209 | | |
136 | 210 | | |
| |||
0 commit comments