search_flip 3.7.2 → 4.0.0.beta

Sign up to get free protection for your applications and to get access to all the features.
@@ -170,7 +170,7 @@ RSpec.describe SearchFlip::Connection do
170
170
  it "freezes the specified index" do
171
171
  connection = SearchFlip::Connection.new
172
172
 
173
- if connection.version.to_f >= 6.6 && connection.version.to_i < 8
173
+ if connection.version.to_f >= 6.6
174
174
  begin
175
175
  connection.create_index("index_name")
176
176
  connection.freeze_index("index_name")
@@ -187,7 +187,7 @@ RSpec.describe SearchFlip::Connection do
187
187
  it "unfreezes the specified index" do
188
188
  connection = SearchFlip::Connection.new
189
189
 
190
- if connection.version.to_f >= 6.6 && connection.version.to_i < 8
190
+ if connection.version.to_f >= 6.6
191
191
  begin
192
192
  connection.create_index("index_name")
193
193
  connection.freeze_index("index_name")
@@ -262,19 +262,12 @@ RSpec.describe SearchFlip::Connection do
262
262
  begin
263
263
  connection = SearchFlip::Connection.new
264
264
 
265
- mapping = { "properties" => { "id" => { "type" => "long" } } }
265
+ mapping = { "type_name" => { "properties" => { "id" => { "type" => "long" } } } }
266
266
 
267
267
  connection.create_index("index_name")
268
+ connection.update_mapping("index_name", mapping, type_name: "type_name")
268
269
 
269
- if connection.version.to_i < 8
270
- connection.update_mapping("index_name", { "type_name" => mapping }, type_name: "type_name")
271
-
272
- expect(connection.get_mapping("index_name", type_name: "type_name")).to eq("index_name" => { "mappings" => { "type_name" => mapping } })
273
- else
274
- connection.update_mapping("index_name", mapping)
275
-
276
- expect(connection.get_mapping("index_name")).to eq("index_name" => { "mappings" => mapping })
277
- end
270
+ expect(connection.get_mapping("index_name", type_name: "type_name")).to eq("index_name" => { "mappings" => mapping })
278
271
  ensure
279
272
  connection.delete_index("index_name") if connection.index_exists?("index_name")
280
273
  end
@@ -315,96 +308,6 @@ RSpec.describe SearchFlip::Connection do
315
308
  end
316
309
  end
317
310
 
318
- describe "#bulk" do
319
- it "imports objects to the specified indices" do
320
- connection = SearchFlip::Connection.new
321
-
322
- bulk = proc do
323
- connection.bulk do |indexer|
324
- indexer.index 1, { id: 1 }, _index: ProductIndex.index_name, ** connection.version.to_i < 8 ? { _type: ProductIndex.type_name } : {}
325
- indexer.index 2, { id: 2 }, _index: ProductIndex.index_name, ** connection.version.to_i < 8 ? { _type: ProductIndex.type_name } : {}
326
- indexer.index 1, { id: 1 }, _index: CommentIndex.index_name, ** connection.version.to_i < 8 ? { _type: CommentIndex.type_name } : {}
327
- end
328
- end
329
-
330
- expect(&bulk).to(change { CommentIndex.total_count }.by(1).and(change { CommentIndex.total_count }.by(1)))
331
- end
332
-
333
- it "raises when no index is given" do
334
- connection = SearchFlip::Connection.new
335
-
336
- bulk = proc do
337
- connection.bulk do |indexer|
338
- indexer.index 1, id: 1
339
- end
340
- end
341
-
342
- expect(&bulk).to raise_error(SearchFlip::ResponseError)
343
- end
344
-
345
- it "respects options" do
346
- connection = SearchFlip::Connection.new
347
-
348
- connection.bulk do |indexer|
349
- indexer.index 1, { id: 1 }, _index: ProductIndex.index_name, ** connection.version.to_i < 8 ? { _type: ProductIndex.type_name } : {}
350
- indexer.index 2, { id: 2 }, _index: ProductIndex.index_name, ** connection.version.to_i < 8 ? { _type: ProductIndex.type_name } : {}
351
- end
352
-
353
- bulk = proc do
354
- connection.bulk do |indexer|
355
- indexer.index 1, { id: 1 }, _index: ProductIndex.index_name, version: 1, version_type: "external", ** connection.version.to_i < 8 ? { _type: ProductIndex.type_name } : {}
356
- indexer.index 2, { id: 2 }, _index: ProductIndex.index_name, version: 1, version_type: "external", ** connection.version.to_i < 8 ? { _type: ProductIndex.type_name } : {}
357
- end
358
- end
359
-
360
- expect(&bulk).to raise_error(SearchFlip::Bulk::Error)
361
-
362
- bulk = proc do
363
- connection.bulk ignore_errors: [409] do |indexer|
364
- indexer.index 1, { id: 1 }, _index: ProductIndex.index_name, version: 1, version_type: "external", ** connection.version.to_i < 8 ? { _type: ProductIndex.type_name } : {}
365
- indexer.index 2, { id: 2 }, _index: ProductIndex.index_name, version: 1, version_type: "external", ** connection.version.to_i < 8 ? { _type: ProductIndex.type_name } : {}
366
- end
367
- end
368
-
369
- expect(&bulk).not_to(change { ProductIndex.total_count })
370
- end
371
-
372
- it "passes default options" do
373
- allow(SearchFlip::Bulk).to receive(:new)
374
-
375
- connection = SearchFlip::Connection.new
376
-
377
- connection.bulk do |indexer|
378
- indexer.index 1, { id: 1 }, _index: ProductIndex.index_name, ** connection.version.to_i < 8 ? { _type: ProductIndex.type_name } : {}
379
- end
380
-
381
- expect(SearchFlip::Bulk).to have_received(:new).with(
382
- anything,
383
- http_client: connection.http_client,
384
- bulk_limit: connection.bulk_limit,
385
- bulk_max_mb: connection.bulk_max_mb
386
- )
387
- end
388
-
389
- it "passes custom options" do
390
- allow(SearchFlip::Bulk).to receive(:new)
391
-
392
- connection = SearchFlip::Connection.new
393
-
394
- options = {
395
- bulk_limit: "bulk limit",
396
- bulk_max_mb: "bulk max mb",
397
- http_client: "http client"
398
- }
399
-
400
- connection.bulk(options) do |indexer|
401
- indexer.index 1, { id: 1 }, _index: ProductIndex.index_name, ** connection.version.to_i < 8 ? { _type: ProductIndex.type_name } : {}
402
- end
403
-
404
- expect(SearchFlip::Bulk).to have_received(:new).with(anything, options)
405
- end
406
- end
407
-
408
311
  describe "#index_url" do
409
312
  it "returns the index url for the specified index" do
410
313
  connection = SearchFlip::Connection.new(base_url: "base_url")
@@ -97,8 +97,7 @@ RSpec.describe SearchFlip::Criteria do
97
97
  methods = [
98
98
  :profile_value, :failsafe_value, :terminate_after_value, :timeout_value,
99
99
  :offset_value, :limit_value, :scroll_args, :source_value, :preference_value,
100
- :search_type_value, :routing_value, :track_total_hits_value, :explain_value,
101
- :http_timeout_value
100
+ :search_type_value, :routing_value, :track_total_hits_value, :explain_value
102
101
  ]
103
102
 
104
103
  methods.each do |method|
@@ -192,22 +191,6 @@ RSpec.describe SearchFlip::Criteria do
192
191
  end
193
192
  end
194
193
 
195
- describe "#http_timeout" do
196
- it "sets the query timeout" do
197
- http_client = double("client").as_null_object
198
- allow(http_client).to receive(:timeout).and_return(http_client)
199
- allow(http_client).to receive(:post).and_raise(SearchFlip::TimeoutError)
200
- allow(ProductIndex.connection).to receive(:http_client).and_return(http_client)
201
-
202
- expect { ProductIndex.http_timeout(1).execute }.to raise_error(SearchFlip::TimeoutError)
203
- expect(http_client).to have_received(:timeout).with(1)
204
- end
205
-
206
- it "executes without errors" do
207
- expect { ProductIndex.http_timeout(1).execute }.not_to raise_error
208
- end
209
- end
210
-
211
194
  describe "#terminate_after" do
212
195
  it "sets the terminate after value" do
213
196
  query = ProductIndex.terminate_after(1)
@@ -433,18 +416,6 @@ RSpec.describe SearchFlip::Criteria do
433
416
  end
434
417
  end
435
418
 
436
- describe "#match_none" do
437
- it "does not match any documents" do
438
- if ProductIndex.connection.version.to_i >= 5
439
- ProductIndex.import create(:product)
440
-
441
- query = ProductIndex.match_none
442
-
443
- expect(query.records).to eq([])
444
- end
445
- end
446
- end
447
-
448
419
  describe "#exists" do
449
420
  it "sets up the constraints correctly and is chainable" do
450
421
  product1 = create(:product, title: "title1", description: "description1")
@@ -1221,19 +1192,13 @@ RSpec.describe SearchFlip::Criteria do
1221
1192
  end
1222
1193
 
1223
1194
  describe "#failsafe" do
1224
- [SearchFlip::ConnectionError, SearchFlip::TimeoutError, SearchFlip::ResponseError.new(code: "code", body: "body")].each do |error|
1225
- it "prevents #{error}" do
1226
- http_client = double("client").as_null_object
1227
- allow(http_client).to receive(:post).and_raise(error)
1228
- allow(ProductIndex.connection).to receive(:http_client).and_return(http_client)
1229
-
1230
- expect { ProductIndex.all.execute }.to raise_error(error)
1195
+ it "prevents query syntax exceptions" do
1196
+ expect { ProductIndex.search("syntax/error").records }.to raise_error(SearchFlip::ResponseError)
1231
1197
 
1232
- query = ProductIndex.failsafe(true)
1198
+ query = ProductIndex.failsafe(true).search("syntax/error")
1233
1199
 
1234
- expect(query.records).to eq([])
1235
- expect(query.total_entries).to eq(0)
1236
- end
1200
+ expect(query.records).to eq([])
1201
+ expect(query.total_entries).to eq(0)
1237
1202
  end
1238
1203
  end
1239
1204
 
@@ -1336,7 +1301,7 @@ RSpec.describe SearchFlip::Criteria do
1336
1301
  ProductIndex.import create(:product)
1337
1302
 
1338
1303
  query = ProductIndex.match_all.explain(true)
1339
- expect(query.results.first._hit.key?(:_explanation)).to eq(true)
1304
+ expect(query.results.first._hit.key?("_explanation")).to eq(true)
1340
1305
  end
1341
1306
  end
1342
1307
 
@@ -1350,40 +1315,28 @@ RSpec.describe SearchFlip::Criteria do
1350
1315
 
1351
1316
  describe "#preference" do
1352
1317
  it "sets the preference" do
1353
- url = ProductIndex.connection.version.to_i < 8 ? "products/products" : "products"
1354
-
1355
- stub_request(:post, "http://127.0.0.1:9200/#{url}/_search?preference=value")
1318
+ stub_request(:post, "http://127.0.0.1:9200/products/products/_search?preference=value")
1356
1319
  .to_return(status: 200, headers: { content_type: "application/json" }, body: "{}")
1357
1320
 
1358
1321
  ProductIndex.preference("value").execute
1359
-
1360
- expect(WebMock).to have_requested(:post, "http://127.0.0.1:9200/#{url}/_search?preference=value")
1361
1322
  end
1362
1323
  end
1363
1324
 
1364
1325
  describe "#search_type" do
1365
1326
  it "sets the search_type" do
1366
- url = ProductIndex.connection.version.to_i < 8 ? "products/products" : "products"
1367
-
1368
- stub_request(:post, "http://127.0.0.1:9200/#{url}/_search?search_type=value")
1327
+ stub_request(:post, "http://127.0.0.1:9200/products/products/_search?search_type=value")
1369
1328
  .to_return(status: 200, headers: { content_type: "application/json" }, body: "{}")
1370
1329
 
1371
1330
  ProductIndex.search_type("value").execute
1372
-
1373
- expect(WebMock).to have_requested(:post, "http://127.0.0.1:9200/#{url}/_search?search_type=value")
1374
1331
  end
1375
1332
  end
1376
1333
 
1377
1334
  describe "#routing" do
1378
1335
  it "sets the search_type" do
1379
- url = ProductIndex.connection.version.to_i < 8 ? "products/products" : "products"
1380
-
1381
- stub_request(:post, "http://127.0.0.1:9200/#{url}/_search?routing=value")
1336
+ stub_request(:post, "http://127.0.0.1:9200/products/products/_search?routing=value")
1382
1337
  .to_return(status: 200, headers: { content_type: "application/json" }, body: "{}")
1383
1338
 
1384
1339
  ProductIndex.routing("value").execute
1385
-
1386
- expect(WebMock).to have_requested(:post, "http://127.0.0.1:9200/#{url}/_search?routing=value")
1387
1340
  end
1388
1341
  end
1389
1342
  end
@@ -7,7 +7,7 @@ class HttpTestRequest
7
7
  self.calls = []
8
8
  end
9
9
 
10
- [:headers, :via, :basic_auth, :auth, :timeout].each do |method|
10
+ [:via, :basic_auth, :auth].each do |method|
11
11
  define_method method do |*args|
12
12
  dup.tap do |request|
13
13
  request.calls = calls + [[method, args]]
@@ -20,7 +20,7 @@ RSpec.describe SearchFlip::HTTPClient do
20
20
  describe "delegation" do
21
21
  subject { SearchFlip::HTTPClient }
22
22
 
23
- [:headers, :via, :basic_auth, :auth, :timeout].each do |method|
23
+ [:headers, :via, :basic_auth, :auth].each do |method|
24
24
  it { should delegate(method).to(:new) }
25
25
  end
26
26
 
@@ -36,12 +36,6 @@ RSpec.describe SearchFlip::HTTPClient do
36
36
 
37
37
  expect(SearchFlip::HTTPClient.new.send(method, "http://localhost/path", body: "body", params: { key: "value" }).body.to_s).to eq("success")
38
38
  end
39
-
40
- it "generates json, passes it as body and sets the content type when the json option is used" do
41
- stub_request(method, "http://localhost/path").with(body: '{"key":"value"}', headers: { "Content-Type" => "application/json" }).to_return(body: "success")
42
-
43
- expect(SearchFlip::HTTPClient.new.send(method, "http://localhost/path", json: { "key" => "value" }).body.to_s).to eq("success")
44
- end
45
39
  end
46
40
  end
47
41
 
@@ -62,12 +56,8 @@ RSpec.describe SearchFlip::HTTPClient do
62
56
  end
63
57
  end
64
58
 
65
- [:headers, :via, :basic_auth, :auth, :timeout].each do |method|
59
+ [:via, :basic_auth, :auth].each do |method|
66
60
  describe "##{method}" do
67
- it "is understood by HTTP" do
68
- expect(HTTP.respond_to?(method)).to eq(true)
69
- end
70
-
71
61
  it "creates a dupped instance" do
72
62
  client = SearchFlip::HTTPClient.new
73
63
  client.request = HttpTestRequest.new
@@ -5,8 +5,8 @@ RSpec.describe SearchFlip::Index do
5
5
  subject { ProductIndex }
6
6
 
7
7
  methods = [
8
- :all, :profile, :where, :where_not, :filter, :range, :match_all, :match_none,
9
- :exists, :exists_not, :post_where, :post_where_not, :post_filter, :post_must,
8
+ :all, :profile, :where, :where_not, :filter, :range, :match_all, :exists,
9
+ :exists_not, :post_where, :post_where_not, :post_filter, :post_must,
10
10
  :post_must_not, :post_should, :post_range, :post_exists, :post_exists_not,
11
11
  :aggregate, :scroll, :source, :includes, :eager_load, :preload, :sort, :resort,
12
12
  :order, :reorder, :offset, :limit, :paginate, :page, :per, :search,
@@ -14,7 +14,7 @@ RSpec.describe SearchFlip::Index do
14
14
  :total_entries, :total_count, :terminate_after, :timeout, :records, :results,
15
15
  :must, :must_not, :should, :find_each_result,
16
16
  :find_results_in_batches, :preference, :search_type, :routing,
17
- :track_total_hits, :explain, :http_timeout
17
+ :track_total_hits, :explain
18
18
  ]
19
19
 
20
20
  methods.each do |method|
@@ -211,21 +211,11 @@ RSpec.describe SearchFlip::Index do
211
211
  mapping = { properties: { id: { type: "long" } } }
212
212
 
213
213
  allow(TestIndex).to receive(:mapping).and_return(mapping)
214
- allow(TestIndex.connection).to receive(:update_mapping)
214
+ allow(TestIndex.connection).to receive(:update_mapping).and_call_original
215
215
 
216
216
  TestIndex.update_mapping
217
217
 
218
- if TestIndex.connection.version.to_i < 8
219
- expect(TestIndex.connection).to have_received(:update_mapping).with("test", { "test" => mapping }, type_name: "test")
220
- else
221
- expect(TestIndex.connection).to have_received(:update_mapping).with("test", mapping)
222
- end
223
- end
224
-
225
- it "updates the mapping" do
226
- TestIndex.create_index
227
-
228
- expect(TestIndex.update_mapping).to eq(true)
218
+ expect(TestIndex.connection).to have_received(:update_mapping).with("test", { "test" => mapping }, type_name: "test")
229
219
  end
230
220
  end
231
221
  end
@@ -268,22 +258,11 @@ RSpec.describe SearchFlip::Index do
268
258
  TestIndex.create_index
269
259
  TestIndex.update_mapping
270
260
 
271
- allow(TestIndex.connection).to receive(:get_mapping)
261
+ allow(TestIndex.connection).to receive(:get_mapping).and_call_original
272
262
 
273
263
  TestIndex.get_mapping
274
264
 
275
- if TestIndex.connection.version.to_i < 8
276
- expect(TestIndex.connection).to have_received(:get_mapping).with("test", type_name: "test")
277
- else
278
- expect(TestIndex.connection).to have_received(:get_mapping).with("test")
279
- end
280
- end
281
-
282
- it "returns the mapping" do
283
- TestIndex.create_index
284
- TestIndex.update_mapping
285
-
286
- expect(TestIndex.get_mapping).to be_present
265
+ expect(TestIndex.connection).to have_received(:get_mapping).with("test", type_name: "test")
287
266
  end
288
267
  end
289
268
  end
@@ -340,7 +319,7 @@ RSpec.describe SearchFlip::Index do
340
319
 
341
320
  TestIndex.type_url
342
321
 
343
- expect(TestIndex.connection).to have_received(:type_url).with("test", TestIndex.connection.version.to_i < 8 ? "test" : "_doc")
322
+ expect(TestIndex.connection).to have_received(:type_url).with("test", "test")
344
323
  end
345
324
  end
346
325
 
@@ -2,16 +2,6 @@ require File.expand_path("../spec_helper", __dir__)
2
2
 
3
3
  RSpec.describe SearchFlip::JSON do
4
4
  describe ".generate" do
5
- it "encodes timestamps correctly" do
6
- Timecop.freeze "2020-06-01 12:00:00 UTC" do
7
- expect(described_class.generate(timestamp: Time.now.utc)).to eq('{"timestamp":"2020-06-01T12:00:00.000Z"}')
8
- end
9
- end
10
-
11
- it "encodes bigdecimals as string" do
12
- expect(described_class.generate(value: BigDecimal(1))).to eq('{"value":"1.0"}')
13
- end
14
-
15
5
  it "delegates to Oj" do
16
6
  allow(Oj).to receive(:dump)
17
7
 
@@ -19,7 +9,7 @@ RSpec.describe SearchFlip::JSON do
19
9
 
20
10
  described_class.generate(payload)
21
11
 
22
- expect(Oj).to have_received(:dump).with(payload, mode: :custom, use_to_json: true, time_format: :xmlschema, bigdecimal_as_decimal: false)
12
+ expect(Oj).to have_received(:dump).with(payload, mode: :custom, use_to_json: true)
23
13
  end
24
14
 
25
15
  it "generates json" do
@@ -28,18 +18,14 @@ RSpec.describe SearchFlip::JSON do
28
18
  end
29
19
 
30
20
  describe ".parse" do
31
- it "returns the parsed json payload" do
32
- expect(described_class.parse('{"key":"value"}')).to eq("key" => "value")
33
- end
34
-
35
- it "delegates to JSON" do
36
- allow(JSON).to receive(:parse)
21
+ it "delegates to Oj" do
22
+ allow(Oj).to receive(:load)
37
23
 
38
24
  payload = '{"key":"value"}'
39
25
 
40
26
  described_class.parse(payload)
41
27
 
42
- expect(JSON).to have_received(:parse).with(payload)
28
+ expect(Oj).to have_received(:load).with(payload)
43
29
  end
44
30
  end
45
31
  end
@@ -7,7 +7,7 @@ RSpec.describe SearchFlip::NullInstrumenter do
7
7
  it "calls start" do
8
8
  allow(subject).to receive(:start)
9
9
 
10
- subject.instrument("name", { key: "value" }) { true }
10
+ subject.instrument("name", { key: "value" }) {}
11
11
 
12
12
  expect(subject).to have_received(:start)
13
13
  end
@@ -15,7 +15,7 @@ RSpec.describe SearchFlip::NullInstrumenter do
15
15
  it "calls finish" do
16
16
  allow(subject).to receive(:finish)
17
17
 
18
- subject.instrument("name", { key: "value" }) { true }
18
+ subject.instrument("name", { key: "value" }) {}
19
19
 
20
20
  expect(subject).to have_received(:finish)
21
21
  end
@@ -1,6 +1,29 @@
1
1
  require File.expand_path("../spec_helper", __dir__)
2
2
 
3
3
  RSpec.describe SearchFlip::Result do
4
+ describe ".convert" do
5
+ it "deeply converts hashes and arrays" do
6
+ result = described_class.convert("parent" => { "child" => [{ "key1" => "value" }, { "key2" => 3 }] })
7
+
8
+ expect(result.parent.child[0].key1).to eq("value")
9
+ expect(result.parent.child[1].key2).to eq(3)
10
+ end
11
+ end
12
+
13
+ describe "#method_missing" do
14
+ it "returns the value of the key equal to the message name" do
15
+ expect(described_class.convert("some_key" => "value").some_key).to eq("value")
16
+ expect(described_class.new.some_key).to be_nil
17
+ end
18
+ end
19
+
20
+ describe "#responds_to_missing?" do
21
+ it "returns true/false if the key equal to the message name is present or not" do
22
+ expect(described_class.convert("some_key" => nil).respond_to?(:some_key)).to eq(true)
23
+ expect(described_class.convert("some_key" => nil).respond_to?(:other_key)).to eq(false)
24
+ end
25
+ end
26
+
4
27
  describe ".from_hit" do
5
28
  it "adds a _hit key into _source and merges the hit keys into it" do
6
29
  result = SearchFlip::Result.from_hit("_score" => 1.0, "_source" => { "name" => "Some name" })
@@ -8,12 +31,6 @@ RSpec.describe SearchFlip::Result do
8
31
  expect(result).to eq("name" => "Some name", "_hit" => { "_score" => 1.0 })
9
32
  end
10
33
 
11
- it "allows deep method access" do
12
- result = SearchFlip::Result.from_hit("_source" => { "key1" => [{ "key2" => "value" }] })
13
-
14
- expect(result.key1[0].key2).to eq("value")
15
- end
16
-
17
34
  it "works with the _source being disabled" do
18
35
  result = SearchFlip::Result.from_hit("_id" => 1)
19
36
 
@@ -0,0 +1,28 @@
1
+ require File.expand_path("../spec_helper", __dir__)
2
+ require "search_flip/to_json"
3
+
4
+ RSpec.describe "to_json" do
5
+ it "uses the correct format for Time" do
6
+ Timecop.freeze Time.parse("2018-01-01 12:00:00 UTC") do
7
+ expect(Time.now.utc.to_json).to eq("\"2018-01-01T12:00:00.000000Z\"")
8
+ end
9
+ end
10
+
11
+ it "uses the correct format for Date" do
12
+ Timecop.freeze Time.parse("2018-01-01 12:00:00 UTC") do
13
+ expect(Date.today.to_json).to eq("\"2018-01-01\"")
14
+ end
15
+ end
16
+
17
+ it "uses the correct format for DateTime" do
18
+ Timecop.freeze Time.parse("2018-01-01 12:00:00 UTC") do
19
+ expect(Time.now.utc.to_json).to eq("\"2018-01-01T12:00:00.000000Z\"")
20
+ end
21
+ end
22
+
23
+ it "uses the correct format for TimeWithZone" do
24
+ Timecop.freeze Time.parse("2018-01-01 12:00:00 UTC") do
25
+ expect(Time.find_zone("UTC").now.to_json).to eq("\"2018-01-01T12:00:00.000000Z\"")
26
+ end
27
+ end
28
+ end
data/spec/spec_helper.rb CHANGED
@@ -16,8 +16,6 @@ RSpec.configure do |config|
16
16
  TestIndex.delete_index if TestIndex.index_exists?
17
17
  ProductIndex.match_all.delete
18
18
  Product.delete_all
19
- CommentIndex.match_all.delete
20
- Comment.delete_all
21
19
  end
22
20
  end
23
21
 
@@ -86,7 +84,7 @@ class CommentIndex
86
84
  include SearchFlip::Index
87
85
 
88
86
  def self.type_name
89
- connection.version.to_i < 8 ? "comments" : "_doc"
87
+ "comments"
90
88
  end
91
89
 
92
90
  def self.index_name
@@ -136,7 +134,7 @@ class ProductIndex
136
134
  end
137
135
 
138
136
  def self.type_name
139
- connection.version.to_i < 8 ? "products" : "_doc"
137
+ "products"
140
138
  end
141
139
 
142
140
  def self.index_name
@@ -177,7 +175,7 @@ class TestIndex
177
175
  end
178
176
 
179
177
  def self.type_name
180
- connection.version.to_i < 8 ? "test" : "_doc"
178
+ "test"
181
179
  end
182
180
 
183
181
  def self.index_name
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: search_flip
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.2
4
+ version: 4.0.0.beta
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Vetter
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-27 00:00:00.000000000 Z
11
+ date: 2020-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -150,20 +150,6 @@ dependencies:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
- - !ruby/object:Gem::Dependency
154
- name: hashie
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - ">="
158
- - !ruby/object:Gem::Version
159
- version: '0'
160
- type: :runtime
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - ">="
165
- - !ruby/object:Gem::Version
166
- version: '0'
167
153
  - !ruby/object:Gem::Dependency
168
154
  name: http
169
155
  requirement: !ruby/object:Gem::Requirement
@@ -178,20 +164,6 @@ dependencies:
178
164
  - - ">="
179
165
  - !ruby/object:Gem::Version
180
166
  version: '0'
181
- - !ruby/object:Gem::Dependency
182
- name: json
183
- requirement: !ruby/object:Gem::Requirement
184
- requirements:
185
- - - ">="
186
- - !ruby/object:Gem::Version
187
- version: '0'
188
- type: :runtime
189
- prerelease: false
190
- version_requirements: !ruby/object:Gem::Requirement
191
- requirements:
192
- - - ">="
193
- - !ruby/object:Gem::Version
194
- version: '0'
195
167
  - !ruby/object:Gem::Dependency
196
168
  name: oj
197
169
  requirement: !ruby/object:Gem::Requirement
@@ -278,6 +250,7 @@ files:
278
250
  - spec/search_flip/null_instrumenter_spec.rb
279
251
  - spec/search_flip/response_spec.rb
280
252
  - spec/search_flip/result_spec.rb
253
+ - spec/search_flip/to_json_spec.rb
281
254
  - spec/spec_helper.rb
282
255
  homepage: https://github.com/mrkamel/search_flip
283
256
  licenses:
@@ -297,12 +270,27 @@ required_ruby_version: !ruby/object:Gem::Requirement
297
270
  version: '0'
298
271
  required_rubygems_version: !ruby/object:Gem::Requirement
299
272
  requirements:
300
- - - ">="
273
+ - - ">"
301
274
  - !ruby/object:Gem::Version
302
- version: '0'
275
+ version: 1.3.1
303
276
  requirements: []
304
- rubygems_version: 3.2.3
305
- signing_key:
277
+ rubygems_version: 3.0.3
278
+ signing_key:
306
279
  specification_version: 4
307
280
  summary: Full-Featured Elasticsearch Ruby Client with a Chainable DSL
308
- test_files: []
281
+ test_files:
282
+ - spec/delegate_matcher.rb
283
+ - spec/search_flip/aggregation_spec.rb
284
+ - spec/search_flip/aws_sigv4_plugin_spec.rb
285
+ - spec/search_flip/bulk_spec.rb
286
+ - spec/search_flip/connection_spec.rb
287
+ - spec/search_flip/criteria_spec.rb
288
+ - spec/search_flip/http_client_spec.rb
289
+ - spec/search_flip/index_spec.rb
290
+ - spec/search_flip/json_spec.rb
291
+ - spec/search_flip/model_spec.rb
292
+ - spec/search_flip/null_instrumenter_spec.rb
293
+ - spec/search_flip/response_spec.rb
294
+ - spec/search_flip/result_spec.rb
295
+ - spec/search_flip/to_json_spec.rb
296
+ - spec/spec_helper.rb