rom-elasticsearch 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -8
- data/README.md +7 -7
- data/lib/rom-elasticsearch.rb +2 -0
- data/lib/rom/elasticsearch.rb +3 -1
- data/lib/rom/elasticsearch/attribute.rb +2 -0
- data/lib/rom/elasticsearch/commands.rb +2 -0
- data/lib/rom/elasticsearch/dataset.rb +6 -0
- data/lib/rom/elasticsearch/errors.rb +2 -0
- data/lib/rom/elasticsearch/gateway.rb +2 -0
- data/lib/rom/elasticsearch/index_name.rb +2 -0
- data/lib/rom/elasticsearch/plugins/relation/query_dsl.rb +2 -0
- data/lib/rom/elasticsearch/query_methods.rb +2 -0
- data/lib/rom/elasticsearch/relation.rb +60 -0
- data/lib/rom/elasticsearch/relation/loaded.rb +2 -0
- data/lib/rom/elasticsearch/schema.rb +5 -1
- data/lib/rom/elasticsearch/scroll_methods.rb +40 -0
- data/lib/rom/elasticsearch/types.rb +7 -5
- data/lib/rom/elasticsearch/version.rb +3 -1
- metadata +18 -78
- data/.codeclimate.yml +0 -6
- data/.gitignore +0 -22
- data/.rspec +0 -3
- data/.travis.yml +0 -27
- data/.yardopts +0 -7
- data/CONTRIBUTING.md +0 -29
- data/Gemfile +0 -19
- data/Rakefile +0 -19
- data/docker-compose.yml +0 -7
- data/rom-elasticsearch.gemspec +0 -27
- data/spec/integration/rom/elasticsearch/relation/command_spec.rb +0 -47
- data/spec/integration/rom/elasticsearch/relation/multi_index_spec.rb +0 -60
- data/spec/integration/rom/elasticsearch/relation/schema_spec.rb +0 -25
- data/spec/shared/setup.rb +0 -16
- data/spec/shared/unit/user_fixtures.rb +0 -15
- data/spec/shared/unit/users.rb +0 -18
- data/spec/spec_helper.rb +0 -42
- data/spec/unit/rom/elasticsearch/dataset/body_spec.rb +0 -13
- data/spec/unit/rom/elasticsearch/dataset/delete_spec.rb +0 -17
- data/spec/unit/rom/elasticsearch/dataset/params_spec.rb +0 -13
- data/spec/unit/rom/elasticsearch/dataset/put_spec.rb +0 -14
- data/spec/unit/rom/elasticsearch/dataset/query_string_spec.rb +0 -12
- data/spec/unit/rom/elasticsearch/dataset/search_spec.rb +0 -20
- data/spec/unit/rom/elasticsearch/gateway_spec.rb +0 -10
- data/spec/unit/rom/elasticsearch/plugins/relation/query_dsl_spec.rb +0 -34
- data/spec/unit/rom/elasticsearch/relation/call_spec.rb +0 -22
- data/spec/unit/rom/elasticsearch/relation/create_index_spec.rb +0 -75
- data/spec/unit/rom/elasticsearch/relation/dataset_spec.rb +0 -51
- data/spec/unit/rom/elasticsearch/relation/delete_spec.rb +0 -32
- data/spec/unit/rom/elasticsearch/relation/get_spec.rb +0 -22
- data/spec/unit/rom/elasticsearch/relation/map_spec.rb +0 -18
- data/spec/unit/rom/elasticsearch/relation/order_spec.rb +0 -40
- data/spec/unit/rom/elasticsearch/relation/page_spec.rb +0 -20
- data/spec/unit/rom/elasticsearch/relation/pluck_spec.rb +0 -18
- data/spec/unit/rom/elasticsearch/relation/query_spec.rb +0 -18
- data/spec/unit/rom/elasticsearch/relation/query_string_spec.rb +0 -18
- data/spec/unit/rom/elasticsearch/relation/search_spec.rb +0 -18
- data/spec/unit/rom/elasticsearch/relation/to_a_spec.rb +0 -28
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'rom/elasticsearch/relation'
|
2
|
-
|
3
|
-
RSpec.describe ROM::Elasticsearch::Relation, '#search' do
|
4
|
-
subject(:relation) { relations[:users] }
|
5
|
-
|
6
|
-
include_context 'users'
|
7
|
-
|
8
|
-
before do
|
9
|
-
relation.command(:create).(id: 1, name: 'Jane')
|
10
|
-
relation.command(:create).(id: 2, name: 'John')
|
11
|
-
|
12
|
-
relation.refresh
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'returns data matching search options' do
|
16
|
-
expect(relation.search(query: { match: { name: 'Jane' } }).one).to eql(id: 1, name: 'Jane')
|
17
|
-
end
|
18
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'rom/elasticsearch/relation'
|
2
|
-
|
3
|
-
RSpec.describe ROM::Elasticsearch::Relation, '#to_a' do
|
4
|
-
subject(:relation) { relations[:users] }
|
5
|
-
|
6
|
-
include_context 'users'
|
7
|
-
|
8
|
-
before do
|
9
|
-
relation.command(:create).(id: 1, name: 'Jane')
|
10
|
-
relation.command(:create).(id: 2, name: 'John')
|
11
|
-
|
12
|
-
relation.refresh
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'returns user tuples' do
|
16
|
-
expect(relation).to match_array([{ id: 1, name: 'Jane' }, { id: 2, name: 'John' }])
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'returns user structs' do
|
20
|
-
jane, john = relation.with(auto_struct: true).to_a.sort_by(&:name)
|
21
|
-
|
22
|
-
expect(jane.id).to be(1)
|
23
|
-
expect(jane.name).to eql('Jane')
|
24
|
-
|
25
|
-
expect(john.id).to be(2)
|
26
|
-
expect(john.name).to eql('John')
|
27
|
-
end
|
28
|
-
end
|