elastic_record 4.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -6
- data/Gemfile +0 -2
- data/README.md +25 -9
- data/elastic_record.gemspec +1 -1
- data/lib/elastic_record/as_document.rb +41 -0
- data/lib/elastic_record/callbacks.rb +11 -56
- data/lib/elastic_record/connection.rb +1 -1
- data/lib/elastic_record/doctype.rb +43 -0
- data/lib/elastic_record/index/deferred.rb +13 -15
- data/lib/elastic_record/index/documents.rb +23 -13
- data/lib/elastic_record/index/manage.rb +4 -6
- data/lib/elastic_record/index/mapping.rb +7 -26
- data/lib/elastic_record/index/settings.rb +17 -2
- data/lib/elastic_record/index.rb +12 -24
- data/lib/elastic_record/model.rb +14 -4
- data/lib/elastic_record/percolator_model.rb +44 -0
- data/lib/elastic_record/relation.rb +1 -2
- data/lib/elastic_record/searching.rb +5 -1
- data/lib/elastic_record/tasks/index.rake +0 -10
- data/lib/elastic_record.rb +3 -0
- data/test/dummy/app/models/mock_model.rb +108 -0
- data/test/dummy/app/models/project.rb +1 -1
- data/test/dummy/app/models/test_model.rb +1 -102
- data/test/dummy/app/models/test_percolator_model.rb +8 -0
- data/test/dummy/app/models/widget.rb +2 -5
- data/test/dummy/app/models/widget_query.rb +14 -0
- data/test/dummy/config/environments/test.rb +3 -3
- data/test/dummy/config/initializers/elastic_record.rb +1 -1
- data/test/elastic_record/as_document_test.rb +65 -0
- data/test/elastic_record/callbacks_test.rb +6 -81
- data/test/elastic_record/config_test.rb +1 -1
- data/test/elastic_record/doctype_test.rb +45 -0
- data/test/elastic_record/index/documents_test.rb +1 -1
- data/test/elastic_record/index/mapping_test.rb +16 -13
- data/test/elastic_record/index/settings_test.rb +34 -1
- data/test/elastic_record/index_test.rb +7 -15
- data/test/elastic_record/model_test.rb +1 -7
- data/test/elastic_record/percolator_model_test.rb +54 -0
- data/test/elastic_record/relation/batches_test.rb +0 -1
- data/test/elastic_record/relation/delegation_test.rb +0 -1
- data/test/elastic_record/relation/finder_methods_test.rb +0 -1
- data/test/elastic_record/relation_test.rb +0 -2
- data/test/elastic_record/searching_test.rb +7 -0
- metadata +11 -10
- data/lib/elastic_record/index/configurator.rb +0 -18
- data/lib/elastic_record/index/percolator.rb +0 -50
- data/lib/elastic_record/index/warmer.rb +0 -24
- data/lib/elastic_record/relation/admin.rb +0 -13
- data/test/elastic_record/index/configurator_test.rb +0 -18
- data/test/elastic_record/index/percolator_test.rb +0 -45
- data/test/elastic_record/index/warmer_test.rb +0 -20
- data/test/elastic_record/relation/admin_test.rb +0 -28
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class ElasticRecord::Index::WarmerTest < MiniTest::Test
|
4
|
-
def test_create_warmer
|
5
|
-
index.delete_warmer('green') if index.warmer_exists?('green')
|
6
|
-
refute index.warmer_exists?('green')
|
7
|
-
|
8
|
-
index.create_warmer('green', 'query' => { "match_all" => {} })
|
9
|
-
|
10
|
-
assert index.warmer_exists?('green')
|
11
|
-
expected = {"types" => ["widget"], "source" => {"query" => {"match_all"=>{}}}}
|
12
|
-
assert_equal expected, index.get_warmer('green')
|
13
|
-
end
|
14
|
-
|
15
|
-
private
|
16
|
-
|
17
|
-
def index
|
18
|
-
Widget.elastic_index
|
19
|
-
end
|
20
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class ElasticRecord::Relation::AdminTest < MiniTest::Test
|
4
|
-
def test_create_percolator
|
5
|
-
index.delete_percolator('green') if index.percolator_exists?('green')
|
6
|
-
|
7
|
-
relation = Widget.elastic_relation.filter('color' => 'green')
|
8
|
-
relation.create_percolator('green')
|
9
|
-
|
10
|
-
assert_equal relation.as_elastic, index.get_percolator('green')
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_create_warmer
|
14
|
-
index.delete_warmer('green') if index.warmer_exists?('green')
|
15
|
-
|
16
|
-
relation = Widget.elastic_relation.filter('color' => 'green')
|
17
|
-
relation.create_warmer('green')
|
18
|
-
|
19
|
-
assert_equal relation.as_elastic, Widget.elastic_index.get_warmer('green')['source']
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def index
|
25
|
-
Widget.elastic_index
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|