elasticsearch-model 0.1.7 → 0.1.8
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 +4 -4
- data/CHANGELOG.md +26 -1
- data/README.md +1 -1
- data/examples/activerecord_mapping_completion.rb +69 -0
- data/examples/mongoid_article.rb +2 -2
- data/lib/elasticsearch/model.rb +1 -1
- data/lib/elasticsearch/model/adapters/mongoid.rb +2 -12
- data/lib/elasticsearch/model/adapters/multiple.rb +8 -6
- data/lib/elasticsearch/model/importing.rb +3 -0
- data/lib/elasticsearch/model/indexing.rb +62 -8
- data/lib/elasticsearch/model/proxy.rb +2 -1
- data/lib/elasticsearch/model/response.rb +6 -0
- data/lib/elasticsearch/model/response/pagination.rb +25 -6
- data/lib/elasticsearch/model/response/results.rb +1 -1
- data/lib/elasticsearch/model/version.rb +1 -1
- data/test/integration/active_record_basic_test.rb +29 -4
- data/test/integration/multiple_models_test.rb +44 -26
- data/test/support/model.json +1 -0
- data/test/support/model.yml +2 -0
- data/test/unit/adapter_mongoid_test.rb +3 -1
- data/test/unit/importing_test.rb +39 -12
- data/test/unit/indexing_test.rb +111 -22
- data/test/unit/response_pagination_kaminari_test.rb +208 -8
- data/test/unit/response_pagination_will_paginate_test.rb +204 -14
- data/test/unit/response_test.rb +11 -1
- metadata +7 -2
data/test/unit/response_test.rb
CHANGED
@@ -7,7 +7,8 @@ class Elasticsearch::Model::ResponseTest < Test::Unit::TestCase
|
|
7
7
|
def self.document_type; 'bar'; end
|
8
8
|
end
|
9
9
|
|
10
|
-
RESPONSE = { 'took' => '5', 'timed_out' => false, '_shards' => {'one' => 'OK'}, 'hits' => { 'hits' => [] }
|
10
|
+
RESPONSE = { 'took' => '5', 'timed_out' => false, '_shards' => {'one' => 'OK'}, 'hits' => { 'hits' => [] },
|
11
|
+
'aggregations' => {'foo' => {'bar' => 10}}}
|
11
12
|
|
12
13
|
setup do
|
13
14
|
@search = Elasticsearch::Model::Searching::SearchRequest.new OriginClass, '*'
|
@@ -63,5 +64,14 @@ class Elasticsearch::Model::ResponseTest < Test::Unit::TestCase
|
|
63
64
|
|
64
65
|
Elasticsearch::Model::Response::Response.new OriginClass, @search
|
65
66
|
end
|
67
|
+
|
68
|
+
should "access the aggregations" do
|
69
|
+
@search.expects(:execute!).returns(RESPONSE)
|
70
|
+
|
71
|
+
response = Elasticsearch::Model::Response::Response.new OriginClass, @search
|
72
|
+
assert_respond_to response, :aggregations
|
73
|
+
assert_kind_of Hashie::Mash, response.aggregations.foo
|
74
|
+
assert_equal 10, response.aggregations.foo.bar
|
75
|
+
end
|
66
76
|
end
|
67
77
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticsearch-model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karel Minarik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: elasticsearch
|
@@ -336,6 +336,7 @@ files:
|
|
336
336
|
- elasticsearch-model.gemspec
|
337
337
|
- examples/activerecord_article.rb
|
338
338
|
- examples/activerecord_associations.rb
|
339
|
+
- examples/activerecord_mapping_completion.rb
|
339
340
|
- examples/couchbase_article.rb
|
340
341
|
- examples/datamapper_article.rb
|
341
342
|
- examples/mongoid_article.rb
|
@@ -376,6 +377,8 @@ files:
|
|
376
377
|
- test/integration/dynamic_index_name_test.rb
|
377
378
|
- test/integration/mongoid_basic_test.rb
|
378
379
|
- test/integration/multiple_models_test.rb
|
380
|
+
- test/support/model.json
|
381
|
+
- test/support/model.yml
|
379
382
|
- test/test_helper.rb
|
380
383
|
- test/unit/adapter_active_record_test.rb
|
381
384
|
- test/unit/adapter_default_test.rb
|
@@ -436,6 +439,8 @@ test_files:
|
|
436
439
|
- test/integration/dynamic_index_name_test.rb
|
437
440
|
- test/integration/mongoid_basic_test.rb
|
438
441
|
- test/integration/multiple_models_test.rb
|
442
|
+
- test/support/model.json
|
443
|
+
- test/support/model.yml
|
439
444
|
- test/test_helper.rb
|
440
445
|
- test/unit/adapter_active_record_test.rb
|
441
446
|
- test/unit/adapter_default_test.rb
|